我想做的事
基于常見問題
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"
]
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/400678.html
標籤:javascript 节点.js github 新产品经理 语义释放
