Files
atlantis/.github/workflows/atlantis-image.yml
Jeppe Fihl-Pearson 1a342eda4d workflows(atlantis-image): fix building and publishing of Docker images (#1975)
https://github.com/runatlantis/atlantis/pull/1943 changed the way Docker images
were built in GitHub Actions so multi-architecture Docker images now are built,
but it unfortunately included a bug which means it hasn't worked yet on any
released version of Atlantis.

The problem is the change expected environment variables to be replaced in the
regular YAML code instead of just the commands which are run.

This attempts to fix that by instead using the template language available to
access the same environment variable.
This is based on the example provided in the documentation here:
https://docs.github.com/en/actions/learn-github-actions/environment-variables.
2022-01-05 10:57:11 -05:00

62 lines
1.6 KiB
YAML

name: atlantis-image
on:
push:
branches:
- "master"
release:
types:
- "published"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: arm64,arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Packages Container registry
uses: docker/login-action@v1
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@v2
with:
context: .
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: true
tags: |
ghcr.io/runatlantis/atlantis:dev
# Publish release to container registry
- name: populate release version
if: ${{ github.event_name == 'release'}}
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and push atlantis:${{ env.RELEASE_VERSION }} image
if: ${{ github.event_name == 'release'}}
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: true
tags: |
ghcr.io/runatlantis/atlantis:${{ env.RELEASE_VERSION }}
ghcr.io/runatlantis/atlantis:latest