Files
atlantis/.github/workflows/atlantis-image.yml
Clemens Wältken 8e843119f3 build: generalize the image tag in image workflow (#2277)
This allows forks of atlantis to push images to their own ghcr.
2022-05-25 16:08:48 -04:00

78 lines
2.5 KiB
YAML

name: atlantis-image
on:
push:
branches:
- 'master'
tags:
- v*.*.* # stable release like, v0.19.2
- v*.*.*-pre.* # pre release like, v0.19.0-pre.calendardate
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: arm64,arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Packages Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Publish dev image to container registry
- name: Build and push atlantis:dev image
if: ${{ github.event_name == 'push'}}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/atlantis:dev
# Publish release to container registry
- name: populate release version
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and push atlantis:${{ env.RELEASE_VERSION }} image for pre release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-pre.') }}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/atlantis:${{ env.RELEASE_VERSION }}
ghcr.io/${{ github.repository_owner }}/atlantis:latest
- name: Build and push atlantis:${{ env.RELEASE_VERSION }} image for stable release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, '-pre.')) }}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/atlantis:${{ env.RELEASE_VERSION }}
ghcr.io/${{ github.repository_owner }}/atlantis:prerelease-latest