我想做的事
基于常见问题
https://semantic-release.gitbook.io/semantic-release/support/faq#why-is-the-package.jsons-version-not-updated-in-my-repository
我想在新版本上更新 package.json 版本号。
我做了什么
- 使用节点
temp
的README.md和.gitignore为组织创建一个新的空私有 Github 存盘库 - 克隆存盘库
- 通过 git 修复第一条提交讯息
rebase -i --root
并将其更改为feat: initial commit
- 使用内容创建 package.json
{
"name": "temp",
"version": "0.0.0-development",
"repository": {
"type": "git",
"url": "git https://github.com/my-organization/temp.git"
}
}
- 设定语意释放
npm install semantic-release -D
npm install @semantic-release/git -D
npm install @semantic-release/changelog -D
- 创建一个.releaserc.json
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/git"
]
}
- 创建一个新的 Github 作业流release.yml
name: Release on push on main branch
on:
push:
branches:
- main
jobs:
release-on-push-on-main-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release --branches main
- 用讯息提交一切
feat: next commit
- 强制推送到原点
问题
该的package.json档案将无法获得通过语意释放-BOT更新。即使在修改README.md档案并使用feat: this should trigger a new release
.
我如何告诉语意发布推送新的包版本?
uj5u.com热心网友回复:
基于这个问题
https://github.com/semantic-release/semantic-release/issues/1593
您还需要 npm 模块。
npm install @semantic-release/npm -D
"private": true,
如果您不想发布到 npm,请添加到您的 package.json- 将 npm 插件添加到发布组态档中(顺序很重要)
.
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
0 评论