Skip to content

Commit 7799978

Browse files
committed
chore: switch to native arm builder
1 parent 97477d7 commit 7799978

1 file changed

Lines changed: 67 additions & 14 deletions

File tree

.github/workflows/release.yaml

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,22 @@ jobs:
4747
file_glob: true
4848
docker:
4949
needs: semantic-release
50-
runs-on: ubuntu-latest
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
include:
54+
- platform: linux/amd64
55+
runner: ubuntu-latest
56+
- platform: linux/arm64
57+
runner: ubuntu-24.04-arm
58+
runs-on: ${{ matrix.runner }}
5159
steps:
52-
- name: Free disk space
53-
run: |
54-
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
55-
sudo docker image prune --all --force
5660
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
5761

58-
- name: Set up QEMU
59-
uses: docker/setup-qemu-action@v3
62+
- name: Prepare
63+
run: |
64+
platform=${{ matrix.platform }}
65+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
6066
6167
- name: Set up Docker Buildx
6268
uses: docker/setup-buildx-action@v3
@@ -67,17 +73,64 @@ jobs:
6773
username: ${{ secrets.DOCKER_USERNAME }}
6874
password: ${{ secrets.DOCKER_PASSWORD }}
6975

70-
- name: Build and push multi-arch Docker image
76+
- name: Build and push by digest
77+
id: build
78+
uses: docker/build-push-action@v6
79+
with:
80+
context: .
81+
platforms: ${{ matrix.platform }}
82+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
83+
tags: flanksource/batch-runner
84+
85+
- name: Export digest
7186
run: |
72-
docker buildx build \
73-
--platform linux/amd64,linux/arm64 \
74-
--tag flanksource/batch-runner:latest \
75-
--tag flanksource/batch-runner:v${{ needs.semantic-release.outputs.release-version }} \
76-
--push .
87+
mkdir -p ${{ runner.temp }}/digests
88+
digest="${{ steps.build.outputs.digest }}"
89+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
7790
78-
helm:
91+
- name: Upload digest
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: digests-${{ env.PLATFORM_PAIR }}
95+
path: ${{ runner.temp }}/digests/*
96+
if-no-files-found: error
97+
retention-days: 1
98+
99+
docker-merge:
79100
runs-on: ubuntu-latest
80101
needs: [semantic-release, docker]
102+
steps:
103+
- name: Download digests
104+
uses: actions/download-artifact@v4
105+
with:
106+
path: ${{ runner.temp }}/digests
107+
pattern: digests-*
108+
merge-multiple: true
109+
110+
- name: Set up Docker Buildx
111+
uses: docker/setup-buildx-action@v3
112+
113+
- name: Login to DockerHub
114+
uses: docker/login-action@v3
115+
with:
116+
username: ${{ secrets.DOCKER_USERNAME }}
117+
password: ${{ secrets.DOCKER_PASSWORD }}
118+
119+
- name: Create manifest list and push
120+
working-directory: ${{ runner.temp }}/digests
121+
run: |
122+
docker buildx imagetools create \
123+
-t flanksource/batch-runner:latest \
124+
-t flanksource/batch-runner:v${{ needs.semantic-release.outputs.release-version }} \
125+
$(printf 'flanksource/batch-runner@sha256:%s ' *)
126+
127+
- name: Inspect image
128+
run: |
129+
docker buildx imagetools inspect flanksource/batch-runner:v${{ needs.semantic-release.outputs.release-version }}
130+
131+
helm:
132+
runs-on: ubuntu-latest
133+
needs: [semantic-release, docker-merge]
81134
if: needs.semantic-release.outputs.new-release-published == 'true'
82135
steps:
83136
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0

0 commit comments

Comments
 (0)