uses: flownative/action-git-latest-release@v1.1.2 #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- 'v*.*.*' | |
concurrency: | |
group: ci-${{ github.ref }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip build]')" | |
outputs: | |
newTag: ${{ steps.latest_version.outputs.tag }} | |
dockerBuildResult: ${{ steps.build_image.outcome }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: extract branch name | |
id: branch_name | |
run: ref=$(echo ${{ github.ref }} | sed 's@.*/@@') && echo $ref && echo "::set-output name=ref::$ref" | |
- name: Bump version and push tag | |
uses: playtini/github-tag-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
DEFAULT_BUMP: patch | |
SUFFIX: ${{ steps.branch_name.outputs.ref }} | |
- name: Determine latest tracker version | |
id: latest_version | |
uses: flownative/action-git-latest-release@v1.1.2 | |
- name: Build Docker image | |
id: build_image | |
uses: playtini/docker-action-docker-build@master | |
with: | |
tag_ref: ${{ steps.latest_version.outputs.tag }} | |
image_name: ghcr.io/${{ github.repository }} | |
image_tag: ${{ steps.latest_version.outputs.tag }} | |
git_repository_url: https://github.com/${{ github.repository }} | |
git_sha: ${{ github.sha }} | |
registry_password: ${{ secrets.GITHUB_TOKEN }} | |
cleanUp: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: 🌲🌳🦌🐿🌳 Remove tag becaues build failed | |
if: needs.build.outputs.dockerBuildResult == 'failure' | |
run: | | |
echo "Remove git tag by failure (${{ needs.build.outputs.newTag }})" | |
git tag -d ${{ needs.build.outputs.newTag }} && git push origin :refs/tags/${{ needs.build.outputs.newTag }} | |
exit 1 |