@@ -11,8 +11,8 @@ permissions:
11
11
packages : write
12
12
13
13
jobs :
14
- artifact-builder :
15
- name : " Prepare release artifacts"
14
+ artifact-builder-x86 :
15
+ name : " Prepare release artifacts (x86) "
16
16
if : github.ref_type == 'tag'
17
17
runs-on : ubuntu-latest
18
18
container :
55
55
uses : actions/attest-build-provenance@v2
56
56
with :
57
57
subject-path : ' ~/maddy-x86_64-linux-musl.tar.zst'
58
+ artifact-builder-arm :
59
+ name : " Prepare release artifacts (aarch64)"
60
+ if : github.ref_type == 'tag'
61
+ runs-on : ubuntu-22.04-arm
62
+ steps :
63
+ - name : Checkout
64
+ uses : actions/checkout@v4
65
+ - name : Set up Docker Buildx
66
+ uses : docker/setup-buildx-action@v3
67
+ # Building in a Docker container is a workaround for the issue of
68
+ # JavaScript-based GitHub Actions not being supported in Alpine
69
+ # containers on the Arm64 platform. Otherwise, we could completely reuse
70
+ # artifact-builder-x86 as a matrix job by running it on an Arm runner.
71
+ - name : Build in Docker container
72
+ run : |
73
+ # Create Dockerfile for the build
74
+ cat > Dockerfile << 'EOF'
75
+ FROM alpine:edge
76
+ RUN apk add --no-cache gcc go zstd musl-dev scdoc
77
+ WORKDIR /build
78
+ COPY . .
79
+ RUN ./build.sh --builddir /package-output/ --static build && \
80
+ ver=$(cat .version) && \
81
+ if [ "v$ver" != "${{github.ref_name}}" ]; then echo ".version does not match the Git tag"; exit 1; fi && \
82
+ mv /package-output/ /maddy-$ver-aarch64-linux-musl && \
83
+ cd / && \
84
+ tar c ./maddy-$ver-aarch64-linux-musl | zstd > /maddy-aarch64-linux-musl.tar.zst
85
+ EOF
86
+ # Build the image, create a temporary container and copy the artifact.
87
+ docker build -t maddy-builder .
88
+ container_id=$(docker create maddy-builder)
89
+ docker cp $container_id:/maddy-aarch64-linux-musl.tar.zst .
90
+ docker rm $container_id
91
+ - name : Upload binary tree
92
+ uses : actions/upload-artifact@v4
93
+ with :
94
+ name : maddy-binary-aarch64.tar.zst
95
+ path : maddy-aarch64-linux-musl.tar.zst
96
+ if-no-files-found : error
97
+ - name : " Generate artifact attestation"
98
+ uses : actions/attest-build-provenance@v2
99
+ with :
100
+ subject-path : ' maddy-aarch64-linux-musl.tar.zst'
58
101
docker-builder :
59
102
name : " Build & push Docker image"
60
103
if : github.ref_type == 'tag'
0 commit comments