Skip to content

Commit 02485fa

Browse files
committed
ci(release): #260 S2 — per-platform compiler binaries + SHA256SUMS (ADR-019)
ADR-019 slice S2. `release.yml` was a single linux job emitting one tar.gz. Reworked into the Releases-canonical artifact contract: - `prepare`: idempotent `gh release create <tag> --generate-notes`. - `build` matrix → `affinescript-<target>` raw executables for linux-x64, macos-x64 (macos-13), macos-arm64 (macos-14); each `gh release upload --clobber`. - `checksums` (needs build): `gh release download` all binaries, `sha256sum … > SHA256SUMS`, upload it. One manifest over all targets — the supply-chain pin the #260 S3 shim embeds per version. Asset contract is now ADR-019-fixed: `affinescript-<target>` + `SHA256SUMS` (don't rename without amending ADR-019 + the shim). Asset handling uses the runner-native `gh` CLI (GITHUB_TOKEN) so no new third-party action needs SHA-pinning — only the already-pinned checkout (de0fac2) + setup-ocaml (e32b06) remain; the unpinned softprops/action-gh-release is dropped. `windows-x64` is a tracked follow-up (native OCaml Windows CI is flaky; S2 bounded to the three POSIX targets, fail-fast:false so one platform can't sink the rest). CI-workflow only — no compiler/source/test change (dune gate unaffected: 295/295 on the base). Triggers only on `v*` tags. Refs #260 #282. Not Closes — S3 (the shim) + S4 (wire INT-10) remain.
1 parent 8af9b46 commit 02485fa

1 file changed

Lines changed: 70 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
#
3+
# Release (ADR-019 / #260 S2). On a `v*` tag: build the AffineScript
4+
# compiler for each supported platform, attach the raw per-platform
5+
# binaries plus a single `SHA256SUMS` manifest to the GitHub Release.
6+
# Releases are the CANONICAL distribution artifact; the thin Deno/JSR
7+
# shim `@hyperpolymath/affinescript` (#260 S3) downloads + checksum-
8+
# verifies the binary named for its host triple against SHA256SUMS.
9+
#
10+
# Asset contract (ADR-019; do not rename without amending the ADR + the
11+
# shim): `affinescript-<target>` raw executables + `SHA256SUMS`
12+
# (sha256sum format: "<hex> affinescript-<target>"). Targets:
13+
# linux-x64, macos-x64, macos-arm64. windows-x64 is a tracked
14+
# follow-up (native OCaml Windows CI is flaky; #260 S2 is bounded to
15+
# the three POSIX targets).
16+
#
17+
# Asset handling uses the runner-native `gh` CLI (GITHUB_TOKEN), so no
18+
# third-party action needs SHA-pinning beyond checkout + setup-ocaml.
19+
220
name: Release
321

422
on:
@@ -10,9 +28,35 @@ permissions:
1028
contents: write
1129

1230
jobs:
13-
release:
31+
prepare:
1432
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
- name: Create the release (idempotent)
37+
env:
38+
GH_TOKEN: ${{ github.token }}
39+
run: |
40+
tag="${GITHUB_REF_NAME}"
41+
if gh release view "$tag" >/dev/null 2>&1; then
42+
echo "release $tag already exists; reusing"
43+
else
44+
gh release create "$tag" --generate-notes --verify-tag --title "$tag"
45+
fi
1546
47+
build:
48+
needs: prepare
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
include:
53+
- os: ubuntu-latest
54+
target: linux-x64
55+
- os: macos-13
56+
target: macos-x64
57+
- os: macos-14
58+
target: macos-arm64
59+
runs-on: ${{ matrix.os }}
1660
steps:
1761
- name: Checkout code
1862
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -23,19 +67,34 @@ jobs:
2367
ocaml-compiler: "5.1"
2468

2569
- name: Install dependencies
26-
run: opam install . --deps-only
70+
run: opam install . --deps-only --yes
2771

2872
- name: Build release
2973
run: opam exec -- dune build --release
3074

31-
- name: Create release archive
75+
- name: Stage the binary
3276
run: |
33-
mkdir -p dist
34-
cp _build/default/bin/main.exe dist/affinescript-linux-x64 || true
35-
tar -czvf affinescript-linux-x64.tar.gz -C dist .
77+
install -m 0755 _build/default/bin/main.exe \
78+
"affinescript-${{ matrix.target }}"
3679
37-
- name: Create GitHub Release
38-
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v2
39-
with:
40-
files: affinescript-linux-x64.tar.gz
41-
generate_release_notes: true
80+
- name: Upload the binary to the release
81+
env:
82+
GH_TOKEN: ${{ github.token }}
83+
run: |
84+
gh release upload "${GITHUB_REF_NAME}" \
85+
"affinescript-${{ matrix.target }}" --clobber
86+
87+
checksums:
88+
needs: build
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Collect binaries and publish SHA256SUMS
92+
env:
93+
GH_TOKEN: ${{ github.token }}
94+
run: |
95+
tag="${GITHUB_REF_NAME}"
96+
mkdir -p dl
97+
gh release download "$tag" --dir dl --pattern 'affinescript-*'
98+
( cd dl && sha256sum affinescript-* | sort -k2 > SHA256SUMS )
99+
cat dl/SHA256SUMS
100+
gh release upload "$tag" dl/SHA256SUMS --clobber

0 commit comments

Comments
 (0)