fix: Multi-arch builds as one step #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# GitHub recommends pinning actions to a commit SHA. | |
# To get a newer version, you will need to update the SHA. | |
# You can also reference a tag or branch, but the action may change without warning. | |
name: Build and publish Docker image | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- test/** | |
- build/** | |
jobs: | |
build-and-push: | |
## The matrix build doesn't work right now, because the push step for the slowest arch | |
## will overwrite the metadata for the faster arch. | |
## We should implement this to fix it: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners | |
# strategy: | |
# matrix: | |
# arch: | |
# - linux/amd64 | |
# - linux/arm64 | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1 | |
# - name: Log in to Docker Hub | |
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
# with: | |
# username: sentrybuilder | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Build and push Docker images | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: | | |
ghcr.io/${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:${{ github.sha }} | |
# generate-sbom: | |
# name: Generate SBOM | |
# needs: build-and-push | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Generate SBOM | |
# uses: anchore/sbom-action@07978da4bdb4faa726e52dfc6b1bed63d4b56479 # v0.13.3 | |
# with: | |
# image: getsentry/sentry-kubernetes:latest | |
# format: text |