Skip to content

Commit c1bf74d

Browse files
committed
fix(release): produce binaries under immutable releases + portable BSD sed
v0.2.0 shipped SOURCE-ONLY (regression from v0.1.1). Two bugs in the release workflow, both confirmed from the failed v0.2.0 run (26694097435): 1. Immutable releases. `prepare` created a *published* release, then the build matrix uploaded assets to it. The repo enabled immutable releases between v0.1.1 (immutable:false) and v0.2.0 (immutable:true); immutable *published* releases reject asset uploads — the linux leg died with "HTTP 422: Cannot upload assets to an immutable release". Fix: create the release as a DRAFT, upload all binaries + SHA256SUMS into the draft, then publish (--draft=false) last so it seals atomically with all four assets. 2. BSD sed. The version-bake step (added in v0.2.0) used `sed -i "s/..."`, which BSD sed on the macOS runners rejects ("extra characters at the end of l command") — so macos-x64 and macos-arm64 failed before building. Fix: `sed -i.bak ...` (portable across GNU + BSD) and remove the backups. Verified locally: the compiler builds in release mode (ELF x86-64); `--version` and `check` work; the bake substitutions match lib/version.ml + .build/dune-project. v0.2.0 is immutable and cannot be amended, so the binaries are published via a fresh v0.2.1 tag built with this fixed workflow. Refs ADR-019, #260 S2. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lz7pRcec2Z3tVtaAhvB3M8
1 parent 5a42e6e commit c1bf74d

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ jobs:
3434
steps:
3535
- name: Checkout code
3636
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
37-
- name: Create the release (idempotent)
37+
- name: Create the release as a draft (idempotent)
38+
# Immutable releases (enabled on this repo) forbid adding assets to a
39+
# *published* release — the v0.2.0 build legs hit "HTTP 422: Cannot
40+
# upload assets to an immutable release", so it shipped source-only.
41+
# Fix: create the release as a DRAFT (still mutable); the build legs
42+
# upload binaries into the draft and the checksums job publishes it
43+
# last, sealing it atomically with all assets attached.
3844
env:
3945
GH_TOKEN: ${{ github.token }}
4046
run: |
4147
tag="${GITHUB_REF_NAME}"
4248
if gh release view "$tag" >/dev/null 2>&1; then
4349
echo "release $tag already exists; reusing"
4450
else
45-
gh release create "$tag" --generate-notes --verify-tag --title "$tag"
51+
gh release create "$tag" --draft --generate-notes --verify-tag --title "$tag"
4652
fi
4753
build:
4854
needs: prepare
@@ -75,8 +81,14 @@ jobs:
7581
# LSP serverInfo, ONNX producer_version).
7682
run: |
7783
v="${GITHUB_REF_NAME#v}"
78-
sed -i "s/^let value = .*/let value = \"$v\"/" lib/version.ml
79-
sed -i "s/^(version .*)/(version $v)/" .build/dune-project
84+
# Use `sed -i.bak` (backup-suffix attached): both GNU sed (Linux) and
85+
# BSD sed (macOS) accept it. Bare `sed -i "s/..."` makes BSD sed treat
86+
# the script as the backup suffix and the filename as a command, dying
87+
# with "extra characters at the end of l command" — which is exactly
88+
# why the v0.2.0 macOS legs failed before building anything.
89+
sed -i.bak "s/^let value = .*/let value = \"$v\"/" lib/version.ml
90+
sed -i.bak "s/^(version .*)/(version $v)/" .build/dune-project
91+
rm -f lib/version.ml.bak .build/dune-project.bak
8092
echo "Baked version: $v"
8193
grep '^let value' lib/version.ml
8294
grep '^(version' .build/dune-project
@@ -107,3 +119,7 @@ jobs:
107119
( cd dl && sha256sum affinescript-* | sort -k2 > SHA256SUMS )
108120
cat dl/SHA256SUMS
109121
gh release upload "$tag" --repo "$GITHUB_REPOSITORY" dl/SHA256SUMS --clobber
122+
# Seal the release last. Under immutable releases assets can only be
123+
# added while the release is a draft, so publish only once all four
124+
# assets (three binaries + SHA256SUMS) are attached.
125+
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" --draft=false --latest

0 commit comments

Comments
 (0)