From 5d37361635d70f8ae87a7e190058e3eba4d634fd Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Tue, 2 Aug 2022 22:43:29 -0400 Subject: [PATCH 1/2] Push when it's master branch or a tag --- .github/workflows/tests-and-docker-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-and-docker-images.yml b/.github/workflows/tests-and-docker-images.yml index d47a0006..4e5d7f75 100644 --- a/.github/workflows/tests-and-docker-images.yml +++ b/.github/workflows/tests-and-docker-images.yml @@ -113,7 +113,7 @@ jobs: context: . file: docker/${{ matrix.image }}/Dockerfile tags: ghcr.io/cscetbon/${{ matrix.image }}:${{ env.IMAGE }} - push: ${{ env.IMAGE == 'master' }} + push: ${{ env.IMAGE == 'master' || github.ref_type == 'tag' }} - name: Tag Docker image as latest if: ${{ startsWith(github.ref, 'refs/tags/') }} From 2b9e5b843b006db30cb050b4f47332181a687477 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Tue, 2 Aug 2022 22:44:04 -0400 Subject: [PATCH 2/2] Test ref_type in condition --- .github/workflows/tests-and-docker-images.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-and-docker-images.yml b/.github/workflows/tests-and-docker-images.yml index 4e5d7f75..dafb30bf 100644 --- a/.github/workflows/tests-and-docker-images.yml +++ b/.github/workflows/tests-and-docker-images.yml @@ -19,7 +19,7 @@ jobs: not-missing-manifests: runs-on: ubuntu-latest - if: ${{ !startsWith(github.ref, 'refs/tags/') }} + if: ${{ github.ref_type == 'branch' }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -116,7 +116,7 @@ jobs: push: ${{ env.IMAGE == 'master' || github.ref_type == 'tag' }} - name: Tag Docker image as latest - if: ${{ startsWith(github.ref, 'refs/tags/') }} + if: ${{ github.ref_type == 'tag' }} uses: docker/build-push-action@v2.10.0 with: context: .