Files
atlantis/.github/workflows/atlantis-image.yml
Rui Chen ce4c7dbd51 fix(workflows): fix docker image publish flow (#2580)
Signed-off-by: Rui Chen <rui@chenrui.dev>

Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-10-10 10:07:12 -07: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-22.04
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:prerelease-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:latest