Skip to content

Commit 00f7fa0

Browse files
committed
bind releases to the triggering commit
1 parent ac58228 commit 00f7fa0

3 files changed

Lines changed: 47 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
- name: Check out source
3636
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3737
with:
38-
ref: main
38+
# Bind every release attempt to the commit that triggered it. A
39+
# moving main checkout could otherwise package a later push.
40+
ref: ${{ github.sha }}
3941
fetch-depth: 0
4042
persist-credentials: false
4143

@@ -53,7 +55,7 @@ jobs:
5355
BEFORE_SHA: ${{ github.event.before }}
5456
run: |
5557
set -euo pipefail
56-
main_sha="$(git rev-parse origin/main)"
58+
event_sha="$(git rev-parse HEAD)"
5759
version="$(tr -d '[:space:]' < macos/VERSION)"
5860
windows_version="$(tr -d '[:space:]' < windows/VERSION)"
5961
package_version="$(node -p "JSON.parse(require('fs').readFileSync('macos/package.json', 'utf8')).version")"
@@ -74,7 +76,7 @@ jobs:
7476
fi
7577
7678
tag="v$version"
77-
release_sha="$main_sha"
79+
release_sha="$event_sha"
7880
should_release="true"
7981
version_unchanged="false"
8082
if [[ "$EVENT_NAME" == "push" ]]; then

TASK_PROGRESS.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
- [base] Feature PR #324 was squash-merged to `main` at
66
`a58e63c6909082706c02824622d0e902b3539065`; its exact-head CI run
77
`30638018730` passed all four jobs.
8-
- [scope] Branch `codex/release-v1.5.10` changes only the six required version
9-
sources, version-bound assertions, dual-platform changelogs, and this durable
10-
release record. Public v1.5.9 is the predecessor; v1.5.10 does not yet exist.
8+
- [scope] Branch `codex/release-v1.5.10` changes the six required version
9+
sources, version-bound assertions, dual-platform changelogs, the exact-event
10+
Release binding and its regression, plus this durable release record. Public
11+
v1.5.9 is the predecessor; v1.5.10 does not yet exist.
1112
- [verified locally] All six release version sources are exactly `1.5.10`.
12-
Portable macOS/Windows Node regressions pass 81/81, and the complete
13+
Portable macOS/Windows Node regressions pass 82/82, and the complete
1314
applicable macOS suite exits 0 with only its documented full-Xcode native
1415
XCTest and installed signed-Codex Doctor branches skipped. Runtime asset
1516
sync, all Node/Bash syntax, both payload checks, PowerShell 5.1 BOM and
@@ -20,6 +21,11 @@
2021
- [pushed/PR open] Branch `codex/release-v1.5.10` is on `origin`; release PR
2122
#332 targets `main` at
2223
`https://github.com/Fei-Away/Codex-Dream-Skin/pull/332`.
24+
- [fixed before merge] Independent release review found the guard checked out
25+
moving `main`, so a later push could retarget v1.5.10 before packaging. The
26+
guard now checks out `${{ github.sha }}`, derives the release candidate from
27+
that exact `HEAD`, and has a portable regression rejecting moving-main
28+
release binding.
2329
- [pending] Require all PR CI jobs on the final head, merge #332 to `main`,
2430
then verify the sole Release workflow creates tag v1.5.10 and publishes
2531
non-empty DMG, Setup.exe, and SHA256SUMS.txt from the exact merge.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import assert from "node:assert/strict";
2+
import fs from "node:fs/promises";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
6+
const here = path.dirname(fileURLToPath(import.meta.url));
7+
const workflowPath = path.resolve(here, "../../.github/workflows/release.yml");
8+
const workflow = await fs.readFile(workflowPath, "utf8");
9+
10+
assert.match(
11+
workflow,
12+
/^\s+ref: \$\{\{ github\.sha \}\}\s*$/m,
13+
"The release guard must check out the immutable event commit.",
14+
);
15+
assert.doesNotMatch(
16+
workflow,
17+
/^\s+ref: main\s*$/m,
18+
"The release guard must not check out moving main.",
19+
);
20+
assert.match(
21+
workflow,
22+
/^\s+event_sha="\$\(git rev-parse HEAD\)"\s*$/m,
23+
"The release candidate must derive from the checked-out event commit.",
24+
);
25+
assert.match(workflow, /^\s+release_sha="\$event_sha"\s*$/m);
26+
assert.doesNotMatch(
27+
workflow,
28+
/main_sha="\$\(git rev-parse origin\/main\)"/,
29+
"The release candidate must not be rebound to a later origin/main tip.",
30+
);
31+
32+
console.log("PASS: Release workflow binds assets and tag to the exact event commit.");

0 commit comments

Comments
 (0)