From 3c27fbbfc03edd2bc01183a87869c8d36723c718 Mon Sep 17 00:00:00 2001 From: Dylan Page Date: Thu, 11 May 2023 22:34:14 -0400 Subject: [PATCH] fix(ci): only push docker dev tag on main (#3393) - Disables pushing a dev tag within an unmerged pr commit event. - Also disabled pushing at all unless the event comes from the main branch --- .github/workflows/atlantis-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/atlantis-image.yml b/.github/workflows/atlantis-image.yml index 12935fee6..c9c376a46 100644 --- a/.github/workflows/atlantis-image.yml +++ b/.github/workflows/atlantis-image.yml @@ -31,8 +31,8 @@ jobs: env: # Set docker repo to either the fork or the main repo where the branch exists DOCKER_REPO: ghcr.io/${{ github.repository }} - # Push if not a pull request or this is a fork - PUSH: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} + # Push if not a pull request and references the main branch + PUSH: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 @@ -75,9 +75,9 @@ jobs: type=semver,pattern={{version}},prefix=v,enable=${{ matrix.image_type == 'alpine' }} type=semver,pattern={{major}}.{{minor}},prefix=v,suffix=${{ env.SUFFIX }} # dev - type=raw,value=dev,suffix=${{ env.SUFFIX }}-{{ sha }} - type=raw,event=push,value=dev,enable=${{ github.ref == format('refs/heads/{0}', 'main') && matrix.image_type == 'alpine' }},suffix= type=raw,event=push,value=dev,enable={{is_default_branch}},suffix=${{ env.SUFFIX }} + type=raw,event=push,value=dev,enable={{is_default_branch}},suffix=${{ env.SUFFIX }}-{{ sha }} + type=raw,event=push,value=dev,enable=${{ github.ref == format('refs/heads/{0}', 'main') && matrix.image_type == 'alpine' }},suffix= # prerelease type=raw,event=tag,value=prerelease-latest,enable=${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'pre') && matrix.image_type == 'alpine' }},suffix= type=raw,event=tag,value=prerelease-latest,enable=${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'pre') }},suffix=${{ env.SUFFIX }}