Skip to content

Commit 0b0c889

Browse files
committed
feat: try running arm64 build actions on macos-latest runner
1 parent f00df50 commit 0b0c889

File tree

2 files changed

+82
-55
lines changed

2 files changed

+82
-55
lines changed

.github/workflows/build-steps.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Steps
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ inputs.platform == 'linux/arm64' && 'macos-latest' || 'ubuntu-latest' }}
13+
steps:
14+
-
15+
name: Prepare
16+
run: |
17+
echo "PLATFORM_PAIR=${{ inputs.platform//\//- }}" >> $GITHUB_ENV
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v4
21+
-
22+
name: Docker meta
23+
id: meta
24+
uses: docker/metadata-action@v5
25+
with:
26+
images: ${{ env.REGISTRY_IMAGE }}
27+
-
28+
name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
-
31+
name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
-
34+
name: Login to Docker Hub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
-
40+
name: Build and push by digest
41+
id: build
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
file: ./deployments/Dockerfile
46+
platforms: ${{ inputs.platform }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
49+
build-args: |
50+
RUNTIME=${{ github.event.inputs.runtime || 'hackmdio/runtime:16.20.2-35fe7e39' }}
51+
BUILDPACK=${{ github.event.inputs.buildpack || 'hackmdio/buildpack:16.20.2-35fe7e39' }}
52+
-
53+
name: Export digest
54+
run: |
55+
mkdir -p /tmp/digests
56+
digest="${{ steps.build.outputs.digest }}"
57+
touch "/tmp/digests/${digest#sha256:}"
58+
-
59+
name: Upload digest
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: digests-${{ env.PLATFORM_PAIR }}
63+
path: /tmp/digests/*
64+
if-no-files-found: error
65+
retention-days: 1

.github/workflows/push-image.yml

+17-55
Original file line numberDiff line numberDiff line change
@@ -18,73 +18,35 @@ env:
1818
REGISTRY_IMAGE: hackmdio/hackmd
1919

2020
jobs:
21-
build:
21+
build-amd64:
2222
runs-on: ubuntu-latest
23-
strategy:
24-
fail-fast: false
25-
matrix:
26-
platform:
27-
- linux/amd64
28-
- linux/arm64
2923
steps:
3024
-
31-
name: Prepare
32-
run: |
33-
platform=${{ matrix.platform }}
34-
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
35-
-
36-
name: Checkout
37-
uses: actions/checkout@v4
25+
name: Set Platform Variable
26+
run: echo "PLATFORM_PAIR=linux-amd64" >> $GITHUB_ENV
3827
-
39-
name: Docker meta
40-
id: meta
41-
uses: docker/metadata-action@v5
28+
name: Execute Build Steps
29+
uses: ./.github/workflows/build-steps.yml
4230
with:
43-
images: ${{ env.REGISTRY_IMAGE }}
44-
-
45-
name: Set up QEMU
46-
uses: docker/setup-qemu-action@v3
47-
-
48-
name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v3
50-
-
51-
name: Login to Docker Hub
52-
uses: docker/login-action@v3
53-
with:
54-
username: ${{ secrets.DOCKERHUB_USERNAME }}
55-
password: ${{ secrets.DOCKERHUB_TOKEN }}
56-
-
57-
name: Build and push by digest
58-
id: build
59-
uses: docker/build-push-action@v5
60-
with:
61-
context: .
62-
file: ./deployments/Dockerfile
63-
platforms: ${{ matrix.platform }}
64-
labels: ${{ steps.meta.outputs.labels }}
65-
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
66-
build-args: |
67-
RUNTIME=${{ github.event.inputs.runtime || 'hackmdio/runtime:16.20.2-35fe7e39' }}
68-
BUILDPACK=${{ github.event.inputs.buildpack || 'hackmdio/buildpack:16.20.2-35fe7e39' }}
31+
platform: linux/amd64
32+
33+
build-arm64:
34+
runs-on: macos-latest
35+
steps:
6936
-
70-
name: Export digest
71-
run: |
72-
mkdir -p /tmp/digests
73-
digest="${{ steps.build.outputs.digest }}"
74-
touch "/tmp/digests/${digest#sha256:}"
37+
name: Set Platform Variable
38+
run: echo "PLATFORM_PAIR=linux-arm64" >> $GITHUB_ENV
7539
-
76-
name: Upload digest
77-
uses: actions/upload-artifact@v4
40+
name: Execute Build Steps
41+
uses: ./.github/workflows/build-steps.yml
7842
with:
79-
name: digests-${{ env.PLATFORM_PAIR }}
80-
path: /tmp/digests/*
81-
if-no-files-found: error
82-
retention-days: 1
43+
platform: linux/arm64
8344

8445
merge:
8546
runs-on: ubuntu-latest
8647
needs:
87-
- build
48+
- build-amd64
49+
- build-arm64
8850
steps:
8951
-
9052
name: Download digests

0 commit comments

Comments
 (0)