我想做的事
基于常见问题解答
我想在新版本上更新 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文件不会被语义发布机器人更新。即使在修改README.md文件并使用feat: this should trigger a new release
.
我如何告诉语义发布推送新的包版本?