尝试使用 changelogithub 生成 github release 发行版
这两个库,更加倾向于设置 github release 的发行版报告,而不是设置到 changelog 文件内。
实际使用下来,在 monorepo 内,效果不好。
工作流:
yaml
- name: 生成github release的信息
run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
更改触发条件
在 monorepo 内,生成的 git tags 不是 v 开头的,需要改写触发条件。
yaml
on:
push:
tags:
- "@ruan-cat/*"
这产生了额外的心智负担。
单标签触发发版时成功
如果推送时,git tag 只包含一个包的标签时,就成功。
多标签触发发版时失败
上述的匹配方式会导致多个工作流启动
一个提交触发了两次部署。发包提交不应该触发多个部署的。
触发多个工作流
并发发包导致的版本号重名
详情
上面说包没有发行,然后实际发行的时候,又被另外的工作流完成了,被干扰了,导致本工作流无法继续执行。
因为已经被完成了,所以发包才会出现这种上下矛盾的情况。
详情
log
🦋 info @ruan-cat/vuepress-preset-config is being published because our local version (0.1.34) has not been published on npm
🦋 info Publishing "@ruan-cat/domains" at "0.6.5"
🦋 info Publishing "@ruan-cat/vuepress-preset-config" at "0.1.34"
🦋 error an error occurred while publishing @ruan-cat/vuepress-preset-config: E403 403 Forbidden - PUT https://registry.npmjs.org/@ruan-cat%2fvuepress-preset-config - You cannot publish over the previously published versions: 0.1.34.
🦋 error In most cases, you or one of your dependencies are requesting
🦋 error a package version that is forbidden by your security policy, or
🦋 error on a server you do not have access to.
🦋 error npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
🦋 error npm error code E403
🦋 error npm error 403 403 Forbidden - PUT https://registry.npmjs.org/@ruan-cat%2fvuepress-preset-config - You cannot publish over the previously published versions: 0.1.34.
🦋 error npm error 403 In most cases, you or one of your dependencies are requesting
🦋 error npm error 403 a package version that is forbidden by your security policy, or
🦋 error npm error 403 on a server you do not have access to.
🦋 error npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-07-01T06_35_14_874Z-debug-0.log
多标签导致 github 修改日志的 url 生成失败
格式不对,无法生成基于 tag 标签的 github 修改日志。
详情
log
Run npx changelogithub
npm warn exec The following package was not found and will be installed: changelogithub@13.16.0
changelogithub v13.16.0
fatal: ambiguous argument '@ruan-cat/vuepress-preset-config@0.1.34...@ruan-cat/domains@0.6.5
@ruan-cat/vuepress-preset-config@0.1.34': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Error: Command failed: git --no-pager log "@ruan-cat/vuepress-preset-config@0.1.34...@ruan-cat/domains@0.6.5
@ruan-cat/vuepress-preset-config@0.1.34" --pretty="----%n%s|%h|%an|%ae%n%b" --name-status
fatal: ambiguous argument '@ruan-cat/vuepress-preset-config@0.1.34...@ruan-cat/domains@0.6.5
@ruan-cat/vuepress-preset-config@0.1.34': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
@ruan-cat/vuepress-preset-config@0.1.34" --pretty="----%n%s|%h|%an|%ae%n%b" --name-status
fatal: ambiguous argument '@ruan-cat/vuepress-preset-config@0.1.34...@ruan-cat/domains@0.6.5
@ruan-cat/vuepress-preset-config@0.1.34': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at execCommand (file:///home/runner/.npm/_npx/b62f3a6189db43a0/node_modules/changelogen/dist/shared/changelogen.a79f5d5c.mjs:14:10)
at getGitDiff (file:///home/runner/.npm/_npx/b62f3a6189db43a0/node_modules/changelogen/dist/shared/changelogen.a79f5d5c.mjs:39:13)
at generate (file:///home/runner/.npm/_npx/b62f3a6189db43a0/node_modules/changelogithub/dist/shared/changelogithub.AtDj_jnB.mjs:431:28)
at async CAC.<anonymous> (file:///home/runner/.npm/_npx/b62f3a6189db43a0/node_modules/changelogithub/dist/cli.mjs:41:37)
Error: Process completed with exit code 1.