Skip to content

Commit b608a61

Browse files
ci: allow product tag v0.1.0 without bumping core package (#44)
The product FlyBot cut tags v0.1.0 while core stays at its own package version 0.1.5-flybot.1 (CHANGELOG [0.1.0] documents that pin), so strict tag==core equality would reject the release. The gate now passes the tag when it is on a product-tag allowlist (currently 0.1.0) and CHANGELOG's section for it contains the current core version; normal releases still require equality, and any other mismatch keeps the existing "core/package.json is X, tag is vY" error. Packing still uses each package's own package.json version via check-pack.mjs, and notes still come from CHANGELOG's [VERSION] section. Co-authored-by: OpenCode <opencode@users.noreply.github.com> Co-authored-by: hs liu <hsliuustc0106@users.noreply.github.com>
1 parent 74bbc9a commit b608a61

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Checks that the release tag version is allowed to ship:
2+
// - core/package.json's version equals the tag (normal releases), or
3+
// - the tag is an allowlisted product tag and CHANGELOG.md's section for it
4+
// documents the current core package version (the product cut pins core).
5+
// Usage: node .github/scripts/check-release-version.mjs <version> (run from the repo root)
6+
import { readFileSync } from 'node:fs'
7+
8+
const PRODUCT_TAGS = ['0.1.0']
9+
10+
const version = process.argv[2]
11+
if (!version) { console.error('usage: check-release-version.mjs <version>'); process.exit(1) }
12+
13+
const have = JSON.parse(readFileSync('core/package.json', 'utf8')).version
14+
const fail = () => { console.error(`core/package.json is ${have}, tag is v${version}`); process.exit(1) }
15+
16+
if (have === version) process.exit(0)
17+
if (!PRODUCT_TAGS.includes(version)) fail()
18+
19+
const lines = readFileSync('CHANGELOG.md', 'utf8').split('\n')
20+
const start = lines.findIndex((l) => l.startsWith(`## [${version}]`))
21+
if (start < 0) fail()
22+
const end = lines.findIndex((l, i) => i > start && l.startsWith('## ['))
23+
const section = lines.slice(start, end < 0 ? undefined : end).join('\n')
24+
if (!section.includes(have)) fail()
25+
26+
console.log(`product tag v${version}: CHANGELOG documents core ${have}, core/package.json unchanged`)

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Release
22

3-
# Pushing a v* tag (matching ds-bot/package.json's version) publishes a GitHub Release with
4-
# the packed ds-bot, social and tree tarballs and that version's CHANGELOG.md section. It
5-
# waits for the Test run on the tagged commit to pass first. Only GITHUB_TOKEN is used.
3+
# Pushing a v* tag publishes a GitHub Release with the packed ds-bot, social and tree
4+
# tarballs and that version's CHANGELOG.md section. It waits for the Test run on the tagged
5+
# commit to pass first. Only GITHUB_TOKEN is used.
6+
# Normally the tag must match core/package.json's version; an allowlisted product tag may
7+
# differ when CHANGELOG.md documents the current core pin. Packing still uses each package's
8+
# own package.json version, and the release notes come from CHANGELOG's [VERSION] section.
69

710
on:
811
push:
@@ -49,12 +52,10 @@ jobs:
4952
node-version: 24
5053
# No cache in a job that publishes: nothing restored from a cache goes into a release.
5154
package-manager-cache: false
52-
- name: Tag matches core/package.json
55+
- name: Tag matches core/package.json (or is an allowlisted product tag)
5356
env:
5457
VERSION: ${{ steps.version.outputs.version }}
55-
run: |
56-
have=$(node -p "require('./core/package.json').version")
57-
[ "$have" = "$VERSION" ] || { echo "core/package.json is $have, tag is v$VERSION" >&2; exit 1; }
58+
run: node .github/scripts/check-release-version.mjs "$VERSION"
5859
- name: Wait for a green Test run on this commit
5960
run: |
6061
sha=$(git rev-parse HEAD)

0 commit comments

Comments
 (0)