From 4267bda85397a775591e5da93813ce1d87a52dee Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 6 Oct 2021 08:49:33 +0200 Subject: [PATCH] Fixing workflow tag syntax issues --- .github/workflows/containers.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml index 2c2428f7..b4f510f8 100644 --- a/.github/workflows/containers.yml +++ b/.github/workflows/containers.yml @@ -1,10 +1,12 @@ name: Build and push containers on: + # Automatically triggered by a testing workflow passing workflow_run: workflows: ["ChangeDetection.io Test"] types: [completed] + # Or a new tagged release release: types: [created, published, edited] @@ -26,6 +28,8 @@ jobs: on-success: runs-on: ubuntu-latest + # If the testing workflow has a success, then we build to :latest + # Or if we are in a tagged release scenario. if: ${{ github.event.workflow_run.conclusion == 'success' }} || ${{ github.event.release.tag_name }} != '' steps: - uses: actions/checkout@v2 @@ -74,6 +78,7 @@ jobs: version: latest driver-opts: image=moby/buildkit:master + # master always builds :latest - name: Build and push :latest id: docker_build if: ${{ github.ref == 'refs/heads/master'}} @@ -89,17 +94,18 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache + # A new tagged release is required, which builds :tag - name: Build and push :tag id: docker_build_tag_release - if: startsWith(github.ref, 'refs/tags/') + if: ${{ github.event.release.tag_name }} != '' uses: docker/build-push-action@v2 with: context: ./ file: ./Dockerfile push: true tags: | - ${{ secrets.DOCKER_HUB_USERNAME }}/changedetection.io:${{ steps.tagName.outputs.tag }} - ghcr.io/dgtlmoon/changedetection.io:${{ steps.tagName.outputs.tag }} + ${{ secrets.DOCKER_HUB_USERNAME }}/changedetection.io:${{ github.event.release.tag_name }} + ghcr.io/dgtlmoon/changedetection.io:${{ github.event.release.tag_name }} platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache