Skip to content

Commit cf34eec

Browse files
authored
Merge pull request #45 from omdsh-dev/fix/release-final-align
fix: pin toolchain, fail on missing changelog section (sibling align)
2 parents 39b851d + 032d8bb commit cf34eec

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
# setup-node's `cache: pnpm` can locate the pnpm store path.
2121
- uses: pnpm/action-setup@v4
2222
with:
23-
version: 11
23+
version: 11.21.0
2424

2525
- uses: actions/setup-node@v4
2626
with:
27-
node-version: "24"
27+
node-version: "24.19.0"
2828
cache: pnpm
2929

3030
- name: Install dependencies

.github/workflows/release-prep.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040
# `cache: pnpm` can locate the pnpm store path (same order as ci.yml).
4141
- uses: pnpm/action-setup@v4
4242
with:
43-
version: 11
43+
version: 11.21.0
4444

4545
- uses: actions/setup-node@v4
4646
with:
47-
node-version: "24"
47+
node-version: "24.19.0"
4848
cache: pnpm
4949

5050
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ jobs:
5353
# `cache: pnpm` can locate the pnpm store path (same order as ci.yml).
5454
- uses: pnpm/action-setup@v4
5555
with:
56-
version: 11
56+
version: 11.21.0
5757

5858
- uses: actions/setup-node@v4
5959
with:
60-
node-version: "24"
60+
node-version: "24.19.0"
6161
registry-url: https://registry.npmjs.org
6262
cache: pnpm
6363

@@ -171,12 +171,15 @@ jobs:
171171
# additionally appends a merge-instruction line; the Release body is
172172
# the section only).
173173
# Guard on the file existing: under `set -e`, awk on a missing
174-
# CHANGELOG.md exits 2 and aborts the step before the fallback could
175-
# run. The version anchor is prefix-safe: the pattern is anchored at
176-
# `^## \[<version>\]`, so `0.1.1` cannot match a `## [0.1.10]` header.
177-
# Fall back to git log (nearest ancestor tag of HEAD, full history
178-
# when no tag exists) only when the file or the section is missing,
179-
# e.g. a release PR prepared before CHANGELOG.md existed.
174+
# CHANGELOG.md exits 2 and aborts the step. The version anchor is
175+
# prefix-safe: the pattern is anchored at `^## \[<version>\]`, so
176+
# `0.1.1` cannot match a `## [0.1.10]` header.
177+
# No git-log fallback on the Release side: every release PR prepared
178+
# by the current prep writes its CHANGELOG section before the PR
179+
# opens, so a missing section is a contract break — fail loudly
180+
# instead of shipping an empty GitHub Release (mirror
181+
# dsh-llm-fallbacks; an empty Release is a silent quality
182+
# regression, not a recoverable one).
180183
VERSION="${{ steps.ver.outputs.version }}"
181184
if [ -f CHANGELOG.md ]; then
182185
# Escape regex metacharacters in the version inside awk (the gsub
@@ -194,11 +197,8 @@ jobs:
194197
' CHANGELOG.md > /tmp/notes.md
195198
fi
196199
if [ ! -s /tmp/notes.md ]; then
197-
PREV_TAG=$(git describe --tags --abbrev=0 HEAD 2>/dev/null || echo "")
198-
git log --oneline --first-parent ${PREV_TAG:+$PREV_TAG..}HEAD > /tmp/notes.md
199-
if [ ! -s /tmp/notes.md ]; then
200-
echo "No commits between releases." > /tmp/notes.md
201-
fi
200+
echo "::error::No changelog section found for v${VERSION} in CHANGELOG.md; refusing to create an empty GitHub Release."
201+
exit 1
202202
fi
203203
204204
- name: Create + push tag

docs/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
2. **构建**`pnpm run typecheck && pnpm run build && pnpm run test`(与 CI 相同的校验命令)。
2424
3. **发布**`npm publish --provenance --access public`,向 npm 发布 `dsh-advisor@X.Y.Z`(认证走 OIDC trusted publishing,无需任何 secret;`--provenance` 显式请求 sigstore 签名,与 dsh-llm-fallbacks 一致)。版本号含 `-` 的 prerelease(如 `0.1.3-alpha.1`)自动带 `--tag <前缀>`(前缀 = 首个 `-` 之后到首个 `.` 之前的文本,如 `alpha`),发布到 `alpha` dist-tag;正式版本(`X.Y.Z`)不带 `--tag`,默认发布到 `latest`
2525
4. **打 tag**:以 `github-actions[bot]` 身份创建并推送注解 tag `vX.Y.Z`(commit message `Release vX.Y.Z`);若该 tag 已存在,tag 步骤会跳过。**tag 跳过只覆盖 tag**——npm 不允许重复发布同一版本(`npm error ... previously published versions`),因此重跑工作流只在 **`npm publish` 步骤本身失败**(尚未发布任何版本、也未创建 tag)时才能继续完成发布;如果发布已经成功(例如随后 tag 或 GitHub Release 步骤失败),重跑会在 `npm publish` 步骤失败,而不是照常发布。**注意「已发布但未打 tag」的缺口**:发布成功后若 tag 步骤失败,仓库中没有任何 `vX.Y.Z` tag(基于 tag 的重复版本检查也拦不住该版本),此时重跑会卡在 `npm publish`;恢复只能人工处理——用 `gh release create vX.Y.Z --generate-notes`(或 `gh release create` 手动编辑正文)为已发布版本补建 tag 与 GitHub Release,或 bump 一个新版本重新走发布流程。
26-
5. **创建 GitHub Release**:以 `vX.Y.Z` 为 tag 与标题创建 Release,正文取自 `CHANGELOG.md` 中对应版本的 `## [X.Y.Z]` 小节(该小节由 **Release prep** 写入并随发布 PR 提交),仅包含该小节本身;PR 正文取自同一小节(提取来源相同),并额外附一行合并说明(见 [§1 步骤 4](#1-发布流程))。版本号含 `-`(如 `0.1.3-alpha.1`)时,该 Release 会被标记为 **Pre-release**,不会作为最新稳定版展示。若该小节缺失(例如在引入 `CHANGELOG.md` 之前准备的旧发布 PR),则回退为自上一个 tag 以来的提交记录(`git log --oneline --first-parent`,取最近祖先 tag 为基准;无 tag 时为完整历史)。注:在 `CHANGELOG.md` 引入之前就已打开的在途发布 PR(例如本次变更时在途的 0.1.1 PR)合并后,其 Release 正文经回退逻辑以 git-log 格式生成,且该版本不会在 `CHANGELOG.md` 中留下小节(同版本不可重复准备);从下一个版本起,Release 正文恢复为对应 `## [X.Y.Z]` 小节
26+
5. **创建 GitHub Release**:以 `vX.Y.Z` 为 tag 与标题创建 Release,正文取自 `CHANGELOG.md` 中对应版本的 `## [X.Y.Z]` 小节(该小节由 **Release prep** 写入并随发布 PR 提交),仅包含该小节本身;PR 正文取自同一小节(提取来源相同),并额外附一行合并说明(见 [§1 步骤 4](#1-发布流程))。版本号含 `-`(如 `0.1.3-alpha.1`)时,该 Release 会被标记为 **Pre-release**,不会作为最新稳定版展示。若该小节缺失(例如绕过 Release prep 手工准备的发布 PR),Release 工作流会直接报错退出(exit 1),拒绝创建空的 GitHub Release——当前 Release prep 生成的每个发布 PR 都会先写入对应小节,缺失即契约被破坏,不再回退到 git log
2727

2828
## 3. 版本策略
2929

0 commit comments

Comments
 (0)