Skip to content

Commit

Permalink
address issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode committed Feb 25, 2023
1 parent ebbe77b commit 7f5525a
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/atlantis-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: atlantis-image


on:
push:
branches:
Expand All @@ -25,7 +26,7 @@ jobs:
runs-on: ubuntu-22.04
env:
# Set docker repo to either the fork or the main repo where the branch exists
DOCKER_REPO: ${{ github.event.pull_request.head.repo.full_name }}
DOCKER_REPO: ${{ 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.full_name != github.repository }}

Expand All @@ -41,6 +42,12 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# release version is the name of the tag i.e. v0.10.0
# release version also has the image type appended i.e. v0.10.0-alpine
# release tag is either pre-release or latest i.e. latest
# release tag also has the image type appended i.e. latest-alpine
# if it's v0.10.0 and alpine, it will do v0.10.0, v0.10.0-alpine, latest, latest-alpine
# if it's v0.10.0 and debian, it will do v0.10.0-debian, latest-debian
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
Expand All @@ -52,19 +59,26 @@ jobs:
labels: |
org.opencontainers.image.licenses=Apache-2.0
tags: |
# semver
type=semver,pattern={{version}},suffix=${{ env.SUFFIX }}
type=semver,pattern={{version}},enable=${{ matrix.image_type == 'alpine' }}
type=semver,pattern={{major}}.{{minor}},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 }}
# 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 }}
# latest
type=raw,event=tag,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'pre') && matrix.image_type == 'alpine' }},suffix=
type=raw,event=tag,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'pre') }},suffix=${{ env.SUFFIX }}
# pr
type=ref,event=pr,suffix=${{ env.SUFFIX }}
type=sha,suffix=${{ env.SUFFIX }}
flavor: |
latest=${{ contains(fromJson('["push", "pull_request"]'), github.event_name) && startsWith(github.ref, 'refs/tags/') }}
suffix=${{ format('-{0}', matrix.image_type) }}
# This is disabled here so we can use the raw form above
latest=false
# Suffix is not used here since there's no way to disable it above
- name: Login to Packages Container registry
uses: docker/login-action@v2
Expand Down Expand Up @@ -92,11 +106,5 @@ jobs:
ATLANTIS_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: ${{ env.PUSH }}
# release version is the name of the tag i.e. v0.10.0
# release version also has the image type appended i.e. v0.10.0-alpine
# release tag is either pre-release or latest i.e. latest
# release tag also has the image type appended i.e. latest-alpine
# if it's v0.10.0 and alpine, it will do v0.10.0, v0.10.0-alpine, latest, latest-alpine
# if it's v0.10.0 and debian, it will do v0.10.0-debian, latest-debian
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 7f5525a

Please sign in to comment.