Repository navigation
build(ci): 补发布链——release published 时 pack、断言资产名契约并上传回读 - #67
Merged
Merged
Conversation
added 8 commits
October 12, 2026 20:19
…ci-release-publish # Conflicts: # test/cli.test.mjs
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更
scripts/publish.mjs(新增):发布链的唯一实现,五步顺序固定——版本权威断言 →pack.mjs产出 → 资产名契约断言 →gh release upload --clobber→ 回读 release 的assets确认资产真的存在。导出assertVersion/assertAssetName/readVersion/packArtifact/readBackAssetNames供离线单测。.github/workflows/publish.yml(新增):on: release: types: [published],permissions: contents: write,run: node scripts/publish.mjs --tag "$GITHUB_REF_NAME"—— 只有这一行委派,断言不在 yml 里重抄。test/cli.test.mjs:三组用例(纯断言含反例、干跑与退出码、yml 单实现防回归)。影响
gh release create会自动补齐资产;漏资产的 release 会被回读步骤判红,而不是静默让安装器在消费侧报release asset not found。直接动因:v1.6.0发布后releases/tags/v1.6.0的assets是空数组,资产是我手工pack.mjs+gh release upload补的(v1.4.0/v1.5.0 各 1 资产,说明历史上一直是手工)。cli.mjs与lib/,命令目录零变化(无新命令键)→ 插件requiresCommands与cliVersion判定不受影响;install-cli.sh的解析逻辑不动;既有test.yml触发矩阵不变;scripts/pack.mjs未改,只是被调用。--clobber使重复触发不产生第二个同名资产;上传前任一断言失败即非零退出不上传。验证
node scripts/publish.mjs --tag v1.6.0 --dry-run --json→ok:true,五步 steps 齐(后两步标skipped (dry-run))。--tag v9.9.9→ exit 1,VERSION_AUTHORITY: package.json 1.6.0 != tag 9.9.9。--tag→ exit 2--tag is required。shadow-dev-cli-latest.tar.gz与shadow-dev-cli-v1.6.0.tgz均抛ASSET_NAME_CONTRACT;shadow-dev-cli-v1.6.0.tar.gz放行。publish.yml必须含委派行,且不得出现pack.mjs/VERSION_AUTHORITY/ASSET_NAME_CONTRACT——断言回拷进 yml 即判红。--test-name-pattern publish.mjs2 绿、publish.yml1 绿、publish全组(含既有 publish 域用例)无回归。upload与read-back只在下一个真实 tag 上端到端执行;本轮无法自证。验收点是 Actions 的publish-release绿 +releases/tags/<新 tag>恰有一个合法名资产。关联