Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use matrix build for multi-arch build #156

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 18 additions & 28 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,17 @@ on:
workflow_dispatch:

jobs:
build-and-push-hawkeye-amd64:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Build and push by digest
uses: ./.github/actions/docker-push-by-digest
id: build
with:
name: hawkeye
file: Dockerfile
outputs:
digest: ${{ steps.build.outputs.digest }}

build-and-push-hawkeye-arm64:
runs-on: buildjet-4vcpu-ubuntu-2204-arm
build-and-push-hawkeye:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, buildjet-4vcpu-ubuntu-2204-arm]
arch: [amd64, arm64]
include:
- os: ubuntu-latest
arch: amd64
- os: buildjet-4vcpu-ubuntu-2204-arm
arch: arm64
permissions:
packages: write
steps:
Expand All @@ -52,38 +46,34 @@ jobs:
name: hawkeye
file: Dockerfile
outputs:
digest: ${{ steps.build.outputs.digest }}
digest-${{ matrix.arch }}: ${{ steps.build.outputs.digest }}

release-hawkeye:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- build-and-push-hawkeye-amd64
- build-and-push-hawkeye-arm64
needs: build-and-push-hawkeye
steps:
- uses: actions/checkout@v4
- name: Merge and push manifest
uses: ./.github/actions/docker-release
with:
name: hawkeye
digests: >
${{needs.build-and-push-hawkeye-amd64.outputs.digest}}
${{needs.build-and-push-hawkeye-arm64.outputs.digest}}
${{ needs.build-and-push-hawkeye.outputs.digest-amd64 }}
${{ needs.build-and-push-hawkeye.outputs.digest-arm64 }}

release-native:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- build-and-push-hawkeye-amd64
- build-and-push-hawkeye-arm64
needs: build-and-push-hawkeye
steps:
- uses: actions/checkout@v4
- name: Merge and push manifest
uses: ./.github/actions/docker-release
with:
name: hawkeye-native
digests: >
ghcr.io/${{ github.repository_owner }}/hawkeye@${{needs.build-and-push-hawkeye-amd64.outputs.digest}}
ghcr.io/${{ github.repository_owner }}/hawkeye@${{needs.build-and-push-hawkeye-arm64.outputs.digest}}
ghcr.io/${{ github.repository_owner }}/hawkeye@${{ needs.build-and-push-hawkeye.outputs.digest-amd64 }}
ghcr.io/${{ github.repository_owner }}/hawkeye@${{ needs.build-and-push-hawkeye.outputs.digest-arm64 }}