@sxwy/semantic-release-template
v1.2.1
Published
semantic-release-template
Downloads
8
Readme
@sxwy/semantic-release-template
用法
单包仓库
配置
package.json
{ "scripts": { "release": "semantic-release" }, "devDependencies": { "@semantic-release/changelog": "^6.0.1", "@semantic-release/git": "^10.0.1", "semantic-release": "^19.0.3" } }
配置
releaserc.js
module.exports = { plugins: [ '@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', [ '@semantic-release/changelog', { changelogFile: 'CHANGELOG.md' } ], '@semantic-release/github', '@semantic-release/npm', [ '@semantic-release/git', { assets: ['CHANGELOG.md', 'package.json'] } ] ] }
配置 .npmrc
registry=https://registry.npmjs.org/ access=public
配置
.github/workflows/publish.yml
name: publish on: push: branches: - master - beta jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: UseNode uses: actions/setup-node@v3 with: node-version: 16 - name: Publish env: GH_TOKEN: ${{ secrets.GH_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | yarn yarn release
然后合并代码到 beta、master 等分支自动触发发布
多包仓库
配置项目
package.json
{ "name": "xxx", "workspaces": [ "packages/*", ], "scripts": { "release": "multi-semantic-release --deps.bump=satisfy --deps.release=patch" }, "devDependencies": { "@semantic-release/changelog": "^6.0.1", "@semantic-release/git": "^10.0.1", "multi-semantic-release": "^2.13.0", "semantic-release": "^19.0.3" } }
配置
releaserc.js
module.exports = { plugins: [ '@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', [ '@semantic-release/changelog', { changelogFile: 'CHANGELOG.md' } ], '@semantic-release/github', '@semantic-release/npm', [ '@semantic-release/git', { assets: ['CHANGELOG.md', 'package.json'] } ] ] }
配置 .npmrc
registry=https://registry.npmjs.org/ access=public
配置
.github/workflows/publish.yml
name: publish on: push: branches: - master - beta jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: UseNode uses: actions/setup-node@v3 with: node-version: 16 - name: Publish env: GH_TOKEN: ${{ secrets.GH_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | yarn yarn release
然后合并代码到 beta、master 等分支自动触发发布