3

当前行为

这是一个全新的项目,所以新版本等。

目前有一个名为“next”的预发布分支,名为“stable”的发布分支,所有功能都在我们的“开发”分支中工作,并且它们具有正确的功能(测试):这是一个测试提交消息。

我们从开发分支创建一个拉取请求到“下一个”。一旦我们对它的外观等感到满意,我们就会将我们的“开发”分支合并到我们的“稳定”分支中。

首先推送“next”会创建一个名为 v1.0.0-next.1 的标签。

但是,另一个专长提交不会将版本增加到 v1.1.0-next.1。它只是创建 v1.0.0-next.2。

如果我随后将我们的“开发”分支拉入我们的“稳定”发布分支,它会更新正确的版本,例如发布 v1.1.0。

我在我的开发分支 package.json 中设置了以下版本

“版本”:“0.0.0-next”,我的版本在 package.json 中也没有像我在本地运行它时那样增加,对于任何分支。

预期的行为 预期的行为将按照正常情况使预发布版本增加,也有我的 package.json 更新。

软件包版本

语义发布版本:“@semantic-release”:“^17.0.4”,“@semantic-release/changelog”:“^5.0.1”,“@semantic-release/commit-analyzer”:“^8.0。 1", "@semantic-release/git": "^9.0.0", "@semantic-release/npm": "^7.0.5", "@semantic-release/release-notes-generator": "^ 9.0.1",

CI环境:

圈子CI

使用的插件:

{
"branches": ["stable", {name: "next", prerelease: true}],
"repositoryUrl": "https://x-token-auth:BB_TOKEN@bitbucket.org/{user}/{repo}.git",
"ci": true,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "./README.md",
}],
"@semantic-release/npm",
["@semantic-release/git", {
"assets": ["./README.md"],
}],
]
}

CI 日志:


    !/bin/bash -eo pipefail
    npx semantic-release --debug
    [6:41:17 AM] [semantic-release] › ℹ Running semantic-release version 17.0.4
    semantic-release:config load config from: /home/circleci/project/.releaserc +0ms
    semantic-release:config options values: {
    semantic-release:config branches: [ 'stable', { name: 'next', prerelease: true } ],
    semantic-release:config repositoryUrl: 'https://x-token-auth: {BB-TOKEN} @bitbucket.org/repo/ui_kit.git',
    semantic-release:config tagFormat: 'v${version}',
    semantic-release:config plugins: [
    semantic-release:config '@semantic-release/commit-analyzer',
    semantic-release:config '@semantic-release/release-notes-generator',
    semantic-release:config [ '@semantic-release/changelog', [Object] ],
    semantic-release:config '@semantic-release/npm',
    semantic-release:config [ '@semantic-release/git', [Object] ]
    semantic-release:config ],
    semantic-release:config ci: true,
    semantic-release:config _: [],
    semantic-release:config debug: true,
    semantic-release:config '$0': 'node_modules/.bin/semantic-release'
    semantic-release:config } +1ms
    semantic-release:plugins options for @semantic-release/changelog/verifyConditions: { changelogFile: './README.md' } +0ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
    semantic-release:plugins options for @semantic-release/npm/verifyConditions: {} +1ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
    semantic-release:plugins options for @semantic-release/git/verifyConditions: { assets: [ './README.md' ] } +1ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
    semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {} +0ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
    semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: {} +0ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
    semantic-release:plugins options for @semantic-release/changelog/prepare: { changelogFile: './README.md' } +1ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
    semantic-release:plugins options for @semantic-release/npm/prepare: {} +0ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
    semantic-release:plugins options for @semantic-release/git/prepare: { assets: [ './README.md' ] } +0ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/git"
    semantic-release:plugins options for @semantic-release/npm/publish: {} +0ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
    semantic-release:plugins options for @semantic-release/npm/addChannel: {} +1ms
    [6:41:17 AM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
    semantic-release:get-tags found tags for branch stable: [] +0ms
    semantic-release:get-tags found tags for branch next: [ { gitTag: 'v1.0.0-next.1', version: '1.0.0-next.1', channels: [ 'next' ] } ] +12ms
    [6:41:20 AM] [semantic-release] › ✔ Run automated release from branch next on repository https://x-token-auth:{BB_TOKEN}@bitbucket.org/repol/ui_kit.git
    [6:41:20 AM] [semantic-release] › ✔ Allowed to push to the Git repository
    [6:41:20 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/changelog"
    [6:41:20 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/changelog"
    [6:41:20 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
    [6:41:20 AM] [semantic-release] [@semantic-release/npm] › ℹ Verify authentication for registry https://registry.npmjs.org/
    [6:41:20 AM] [semantic-release] [@semantic-release/npm] › ℹ Reading npm config from /home/circleci/project/.npmrc
    monarc
    [6:41:21 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
    [6:41:21 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/git"
    [6:41:21 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/git"
    [6:41:21 AM] [semantic-release] › ℹ Found git tag v1.0.0-next.1 associated with version 1.0.0-next.1 on branch next
    semantic-release:get-commits Use from: 55f99bb238d96062ec73a9dadc2623a7afe8ad62 +0ms
    [6:41:21 AM] [semantic-release] › ℹ Found 2 commits since last release
    semantic-release:get-commits Parsed commits: [ { commit: { long: '27c780e14a70bc1558a4e68f795963b6886e45a1', short: '27c780e' }, tree: { long: 'c60fdbf8b833a81ec2b7985094eb6c89b910daa4', short: 'c60fdbf' }, author: { name: ', email: '', date: 2020-04-02T06:40:27.000Z }, committer: { name: 'Dev Ops', email: '', date: 2020-04-02T06:40:27.000Z }, subject: 'Merged in development (pull request #139)', body: 'feat(semver3): next #3\n', hash: '27c780e14a70bc1558a4e68f795963b6886e45a1', committerDate: 2020-04-02T06:40:27.000Z, message: 'Merged in development (pull request #139)\n\nfeat(semver3): next #3', gitTags: '(HEAD -> next, origin/next, master)' }, { commit: { long: '99f14f6759801f942a372000356da552f7427d78', short: '99f14f6' }, tree: { long: '5c6666840eec5cdfd21e8a2032933e7735544e30', short: '5c66668' }, author: { name:{name}, email: '', date: 2020-04-02T06:39:46.000Z }, committer: { name: {name}, email: ', date: 2020-04-02T06:39:46.000Z }, subject: 'feat(semver3): next #3', body: '', hash: '99f14f6759801f942a372000356da552f7427d78', committerDate: 2020-04-02T06:39:46.000Z, message: 'feat(semver3): next #3', gitTags: '(origin/development)' } ] +15ms
    [6:41:21 AM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
    [6:41:21 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: Merged in development (pull request #139)

    feat(semver3): next #3
    semantic-release:commit-analyzer Analyzing with default rules +0ms
    [6:41:21 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
    [6:41:21 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: feat(semver3): next #3
    semantic-release:commit-analyzer Analyzing with default rules +1ms
    semantic-release:commit-analyzer The rule { type: 'feat', release: 'minor' } match commit with release type 'minor' +0ms
    [6:41:21 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ The release type for the commit is minor
    [6:41:21 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analysis of 2 commits complete: minor release
    [6:41:21 AM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
    [6:41:21 AM] [semantic-release] › ℹ The next release version is 1.0.0-next.2
    [6:41:21 AM] [semantic-release] › ℹ Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
    semantic-release:release-notes-generator version: '1.0.0-next.2' +0ms
    semantic-release:release-notes-generator host: undefined +0ms
    semantic-release:release-notes-generator owner: 'monarc_dev' +0ms
    semantic-release:release-notes-generator repository: 'ui_kit' +0ms
    semantic-release:release-notes-generator previousTag: 'v1.0.0-next.1' +0ms
    semantic-release:release-notes-generator currentTag: 'v1.0.0-next.2' +0ms
    semantic-release:release-notes-generator host: 'https://bitbucket.org' +0ms
    semantic-release:release-notes-generator linkReferences: undefined +0ms
    semantic-release:release-notes-generator issue: 'issue' +0ms
    semantic-release:release-notes-generator commit: 'commits' +0ms
    [6:41:21 AM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
    [6:41:21 AM] [semantic-release] › ℹ Start step "prepare" of plugin "@semantic-release/changelog"
    [6:41:21 AM] [semantic-release] [@semantic-release/changelog] › ℹ Update /home/circleci/project/README.md
    [6:41:21 AM] [semantic-release] › ✔ Completed step "prepare" of plugin "@semantic-release/changelog"
    [6:41:21 AM] [semantic-release] › ℹ Start step "prepare" of plugin "@semantic-release/npm"
    [6:41:21 AM] [semantic-release] [@semantic-release/npm] › ℹ Write version 1.0.0-next.2 to package.json in /home/circleci/project
    v1.0.0-next.2
    [6:41:21 AM] [semantic-release] › ✔ Completed step "prepare" of plugin "@semantic-release/npm"
    [6:41:21 AM] [semantic-release] › ℹ Start step "prepare" of plugin "@semantic-release/git"
    [6:41:22 AM] [semantic-release] [@semantic-release/git] › ℹ Found 1 file(s) to commit
    semantic-release:git add file to git index {
    command: 'git add --force --ignore-errors README.md',
    exitCode: 0,
    stdout: '',
    stderr: '',
    all: undefined,
    failed: false,
    timedOut: false,
    isCanceled: false,
    killed: false
    } +0ms
    semantic-release:git commited files: [ 'README.md' ] +0ms
    [6:41:23 AM] [semantic-release] [@semantic-release/git] › ℹ Prepared Git release: v1.0.0-next.2
    [6:41:23 AM] [semantic-release] › ✔ Completed step "prepare" of plugin "@semantic-release/git"
    [6:41:23 AM] [semantic-release] › ℹ Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
    semantic-release:release-notes-generator version: '1.0.0-next.2' +2s
    semantic-release:release-notes-generator host: undefined +0ms
    semantic-release:release-notes-generator owner: 'monarc_dev' +0ms
    semantic-release:release-notes-generator repository: 'ui_kit' +0ms
    semantic-release:release-notes-generator previousTag: 'v1.0.0-next.1' +0ms
    semantic-release:release-notes-generator currentTag: 'v1.0.0-next.2' +1ms
    semantic-release:release-notes-generator host: 'https://bitbucket.org' +0ms
    semantic-release:release-notes-generator linkReferences: undefined +0ms
    semantic-release:release-notes-generator issue: 'issue' +0ms
    semantic-release:release-notes-generator commit: 'commits' +0ms
    [6:41:23 AM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
    [6:41:25 AM] [semantic-release] › ✔ Created tag v1.0.0-next.2
    [6:41:25 AM] [semantic-release] › ℹ Start step "publish" of plugin "@semantic-release/npm"
    [6:41:25 AM] [semantic-release] [@semantic-release/npm] › ℹ Publishing version 1.0.0-next.2 to npm registry on dist-tag next
    npm notice
    npm notice package @monarc-dev/react-toolkit@1.0.0-next.2
    npm notice === Tarball Contents ===
    npm notice 3.0kB package.json
    npm notice 8.8kB README.md
    npm notice === Tarball Details ===
    npm notice name: @monarc-dev/react-toolkit
    npm notice version: 1.0.0-next.2
    npm notice package size: 3.0 kB
    npm notice unpacked size: 11.8 kB
    npm notice shasum: 3abdccb17e58f8e116ffe1dcc6d6271592e4390c
    npm notice integrity: sha512-GOjVWbDMbPyTr[...]KoK2fsQsoPUHg==
    npm notice total files: 2
    npm notice

    @monarc-dev/react-toolkit@1.0.0-next.2
    [6:41:28 AM] [semantic-release] [@semantic-release/npm] › ℹ Published @monarc-dev/react-toolkit@1.0.0-next.2 to dist-tag @next on https://registry.npmjs.org/
    [6:41:28 AM] [semantic-release] › ✔ Completed step "publish" of plugin "@semantic-release/npm"
    [6:41:28 AM] [semantic-release] › ✔ Published release 1.0.0-next.2 on next channel

我尝试过的事情:

添加这些选项并在本地运行。

`ci: false`

`dryRun: true`

在我的计算机上本地npx semantic-release运行,同时在提交会增加版本后签出 beta 分支。同样的问题,例如调试日志报告主要版本增加但仍然保持相同的 1.0.0-next.x,在这种情况下应该是 2.0.0-next.x。

如果有人可以提供帮助,将不胜感激:)

4

1 回答 1

2

我遇到了同样的行为,并深入研究了semantic-release.

在 v17.0.3 中semantic-release切换到使用 Git 注释来存储有关哪些版本发生在哪个分支中的信息。但是,强制推送将覆盖 Git 注释。手动添加注释对我有用。

他们在此处的故障排除文档中有添加注释的说明:

https://github.com/semantic-release/semantic-release/blob/master/docs/support/troubleshooting.md#release-not-found-release-branch-after-git-push---force

于 2020-04-04T20:59:08.547 回答