Skip to content

Commit

Permalink
fix(ci): only push docker dev tag on main (runatlantis#3393)
Browse files Browse the repository at this point in the history
- Disables pushing a dev tag within an unmerged pr commit event.
- Also disabled pushing at all unless the event comes from the main branch
  • Loading branch information
GenPage authored and ijames-gc committed Feb 13, 2024
1 parent aa714b4 commit f4ce569
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/atlantis-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit f4ce569

Please sign in to comment.