Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release is published as pre-release even though branch isn't configured as a pre-release branch #760

Open
higgs01 opened this issue Dec 15, 2023 · 4 comments

Comments

@higgs01
Copy link

higgs01 commented Dec 15, 2023

Configuration / Workflow

I have the following semantic-release config:

{
  branches: [
    'hotfix/v+([0-9])?(.{+([0-9]),x}).x',
    'release-tracker',
    { name: 'master', prerelease: 'snapshot' },
    { name: 'main', prerelease: 'snapshot' }
  ],
  repositoryUrl: 'https://github.com/...redacted...',
  tagFormat: 'v${version}',
  plugins: [
    [ '@semantic-release/commit-analyzer', [Object] ],
    '@semantic-release/release-notes-generator',
    '@semantic-release/github'
  ],
  _: [],
  '$0': 'node_modules/.bin/semantic-release'
}

The master/main-branch publishes snapshot releases and when I want to publish a release, I'll merge master into release-tracker. Semantic-Release is then executed on the release-tracker-branch.

Behaviour

Everything was working fine, until I published my first hotfix-release from the branch hotfix/v1.2.x. Since then all my releases from the release-tracker-branch are marked as pre-release within github.

Expected behaviour

All releases published on release-tracker aren't marked as pre-release in GitHub. Releases on master/main are still marked as pre-release.

Environment / Logs

Versions
Node: 18.19.0

{
  "devDependencies": {
    "@semantic-release/commit-analyzer": "^11.1.0",
    "conventional-changelog-conventionalcommits": "^7.0.2",
    "semantic-release": "^22.0.7"
  }
}
Logs
[9:45:33 AM] [semantic-release] › ℹ  Running semantic-release version 22.0.12
2023-12-15T09:45:33.632Z semantic-release:config load config from: /home/runner/work/**redacted**/release.config.js
2023-12-15T09:45:33.640Z semantic-release:config options values: {
  branches: [
    'hotfix/v+([0-9])?(.{+([0-9]),x}).x',
    'release-tracker',
    { name: 'master', prerelease: 'snapshot' },
    { name: 'main', prerelease: 'snapshot' }
  ],
  repositoryUrl: 'https://github.com/**redacted**',
  tagFormat: 'v${version}',
  plugins: [
    [ '@semantic-release/commit-analyzer', [Object] ],
    '@semantic-release/release-notes-generator',
    '@semantic-release/github'
  ],
  _: [],
  '$0': 'node_modules/.bin/semantic-release'
}
2023-12-15T09:45:33.784Z semantic-release:plugins options for @semantic-release/github/verifyConditions: {}
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
2023-12-15T09:45:33.785Z semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: { preset: 'conventionalcommits' }
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
2023-12-15T09:45:33.785Z semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: {}
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
2023-12-15T09:45:33.786Z semantic-release:plugins options for @semantic-release/github/publish: {}
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
2023-12-15T09:45:33.786Z semantic-release:plugins options for @semantic-release/github/addChannel: {}
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
2023-12-15T09:45:33.787Z semantic-release:plugins options for @semantic-release/github/success: {}
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
2023-12-15T09:45:33.787Z semantic-release:plugins options for @semantic-release/github/fail: {}
[9:45:33 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
2023-12-15T09:45:33.810Z semantic-release:get-git-auth-url Verifying ssh auth by attempting to push to  https://github.com/**redacted**
2023-12-15T09:45:35.671Z semantic-release:get-tags found tags for branch hotfix/v1.2.x: [ { gitTag: 'v1.0.0', version: '1.0.0', channels: [ null ] }, { gitTag: 'v1.0.0-snapshot.1', version: '1.0.0-snapshot.1', channels: [ null ] }, { gitTag: 'v1.1.0', version: '1.1.0', channels: [ null ] }, { gitTag: 'v1.1.0-snapshot.1', version: '1.1.0-snapshot.1', channels: [ 'master' ] }, { gitTag: 'v1.1.0-snapshot.2', version: '1.1.0-snapshot.2', channels: [ null ] }, { gitTag: 'v1.1.1', version: '1.1.1', channels: [ null ] }, { gitTag: 'v1.1.1-snapshot.1', version: '1.1.1-snapshot.1', channels: [ null ] }, { gitTag: 'v1.1.2', version: '1.1.2', channels: [ null ] }, { gitTag: 'v1.1.2-snapshot.1', version: '1.1.2-snapshot.1', channels: [ 'master' ] }, { gitTag: 'v1.1.2-snapshot.2', version: '1.1.2-snapshot.2', channels: [ null ] }, { gitTag: 'v1.2.0', version: '1.2.0', channels: [ null ] }, { gitTag: 'v1.2.0-snapshot.1', version: '1.2.0-snapshot.1', channels: [ null ] }, { gitTag: 'v1.2.1', version: '1.2.1', channels: [ null ] } ]
2023-12-15T09:45:35.754Z semantic-release:get-tags found tags for branch release-tracker: [ { gitTag: 'v1.0.0', version: '1.0.0', channels: [ null ] }, { gitTag: 'v1.0.0-snapshot.1', version: '1.0.0-snapshot.1', channels: [ null ] }, { gitTag: 'v1.1.0', version: '1.1.0', channels: [ null ] }, { gitTag: 'v1.1.0-snapshot.1', version: '1.1.0-snapshot.1', channels: [ 'master' ] }, { gitTag: 'v1.1.0-snapshot.2', version: '1.1.0-snapshot.2', channels: [ null ] }, { gitTag: 'v1.1.1', version: '1.1.1', channels: [ null ] }, { gitTag: 'v1.1.1-snapshot.1', version: '1.1.1-snapshot.1', channels: [ null ] }, { gitTag: 'v1.1.2', version: '1.1.2', channels: [ null ] }, { gitTag: 'v1.1.2-snapshot.1', version: '1.1.2-snapshot.1', channels: [ 'master' ] }, { gitTag: 'v1.1.2-snapshot.2', version: '1.1.2-snapshot.2', channels: [ null ] }, { gitTag: 'v1.2.0', version: '1.2.0', channels: [ null ] }, { gitTag: 'v1.2.0-snapshot.1', version: '1.2.0-snapshot.1', channels: [ null ] }, { gitTag: 'v1.3.0-snapshot.1', version: '1.3.0-snapshot.1', channels: [ 'master' ] } ]
2023-12-15T09:45:35.841Z semantic-release:get-tags found tags for branch master: [ { gitTag: 'v1.0.0', version: '1.0.0', channels: [ null ] }, { gitTag: 'v1.0.0-snapshot.1', version: '1.0.0-snapshot.1', channels: [ null ] }, { gitTag: 'v1.1.0', version: '1.1.0', channels: [ null ] }, { gitTag: 'v1.1.0-snapshot.1', version: '1.1.0-snapshot.1', channels: [ 'master' ] }, { gitTag: 'v1.1.0-snapshot.2', version: '1.1.0-snapshot.2', channels: [ null ] }, { gitTag: 'v1.1.1', version: '1.1.1', channels: [ null ] }, { gitTag: 'v1.1.1-snapshot.1', version: '1.1.1-snapshot.1', channels: [ null ] }, { gitTag: 'v1.1.2', version: '1.1.2', channels: [ null ] }, { gitTag: 'v1.1.2-snapshot.1', version: '1.1.2-snapshot.1', channels: [ 'master' ] }, { gitTag: 'v1.1.2-snapshot.2', version: '1.1.2-snapshot.2', channels: [ null ] }, { gitTag: 'v1.2.0', version: '1.2.0', channels: [ null ] }, { gitTag: 'v1.2.0-snapshot.1', version: '1.2.0-snapshot.1', channels: [ null ] }, { gitTag: 'v1.3.0-snapshot.1', version: '1.3.0-snapshot.1', channels: [ 'master' ] } ]
[9:45:35 AM] [semantic-release] › ✔  Run automated release from branch release-tracker on repository https://github.com/**redacted**
[9:45:36 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[9:45:36 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[9:45:36 AM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication (https://api.github.com)
[9:45:36 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[9:45:36 AM] [semantic-release] › ℹ  Found git tag v1.2.0 associated with version 1.2.0 on branch release-tracker
2023-12-15T09:45:36.032Z semantic-release:get-commits Use from: 2a7f3a996cf11822f9799865dc92a21bd0f53894
[9:45:36 AM] [semantic-release] › ℹ  Found 1 commits since last release
2023-12-15T09:45:36.044Z semantic-release:get-commits Parsed commits: [ { commit: { long: 'd46a0903b3f423a77899cea982ccb10a51dbe6b5', short: 'd46a090' }, tree: { long: '93d16dd676057d2a5b9bb58ae4582f3b5e60d366', short: '93d16dd' }, author: { name: '**redacted**', email: '**redacted**', date: 2023-12-15T09:43:44.000Z }, committer: { name: '**redacted**', email: '**redacted**', date: 2023-12-15T09:43:44.000Z }, subject: 'feat: test trigger 2', body: '', hash: 'd46a0903b3f423a77899cea982ccb10a51dbe6b5', committerDate: 2023-12-15T09:43:44.000Z, message: 'feat: test trigger 2', gitTags: '(HEAD -> release-tracker, tag: v1.3.0-snapshot.1, origin/release-tracker, origin/master, master)' } ]
[9:45:36 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
2023-12-15T09:45:36.055Z semantic-release:commit-analyzer Analyzing with default rules
[9:45:36 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat: test trigger 2
2023-12-15T09:45:36.056Z semantic-release:commit-analyzer The rule { type: 'feat', release: 'minor' } match commit with release type 'minor'
[9:45:36 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is minor
[9:45:36 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 1 commits complete: minor release
[9:45:36 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[9:45:36 AM] [semantic-release] › ℹ  The next release version is 1.3.0
[9:45:36 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
2023-12-15T09:45:36.068Z semantic-release:release-notes-generator version: '1.3.0'
2023-12-15T09:45:36.068Z semantic-release:release-notes-generator host: undefined
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator owner: '**redacted**'
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator repository: '**redacted**'
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator previousTag: 'v1.2.0'
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator currentTag: 'v1.3.0'
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator host: 'https://github.com'
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator linkReferences: undefined
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator issue: 'issues'
2023-12-15T09:45:36.069Z semantic-release:release-notes-generator commit: 'commit'
[9:45:36 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:45:37 AM] [semantic-release] › ✔  Created tag v1.3.0
[9:45:37 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/github"
2023-12-15T09:45:37.482Z semantic-release:github release object: {
  owner: '**redacted**',
  repo: '**redacted**',
  tag_name: 'v1.3.0',
  target_commitish: 'release-tracker',
  name: 'v1.3.0',
  body: '# [1.3.0](https://github.com/**redacted**/compare/v1.2.0...v1.3.0) (2023-12-15)\n' +
    '\n' +
    '\n' +
    '### Features\n' +
    '\n' +
    '* test trigger 2 ([d46a090](https://github.com/**redacted**/commit/d46a0903b3f423a77899cea982ccb10a51dbe6b5))\n' +
    '\n' +
    '\n' +
    '\n',
  prerelease: true
}
[9:45:38 AM] [semantic-release] [@semantic-release/github] › ℹ  Published GitHub release: https://github.com/**redacted**/releases/tag/v1.3.0
[9:45:38 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/github"
[9:45:38 AM] [semantic-release] › ℹ  Start step "success" of plugin "@semantic-release/github"
2023-12-15T09:45:38.482Z semantic-release:github found pull requests: []
2023-12-15T09:45:38.484Z semantic-release:github found issues via comments: []
2023-12-15T09:45:40.470Z semantic-release:github found semantic-release issues: []
[9:45:40 AM] [semantic-release] › ✔  Completed step "success" of plugin "@semantic-release/github"
[9:45:40 AM] [semantic-release] › ✔  Published release 1.3.0 on release-tracker channel
@AirP0WeR
Copy link

AirP0WeR commented Feb 8, 2024

Same issue, do you find solution?

@higgs01
Copy link
Author

higgs01 commented Feb 8, 2024

Same issue, do you find solution?

No, we didn't find a solution for this. We've since moved away from semantic-release (due to different reasons). Therefore we i haven't spent more time looking for a solution/workaround.

@na-ji
Copy link

na-ji commented Jul 24, 2024

This issue is probably coming from this condition in the GitHub plugin:

(type === "release" && !main) ||

No contributors commented about this, but this behavior is probably on purpose, unfortunately.

@ext
Copy link

ext commented Dec 16, 2024

I got hit by this issue too, after reading the referenced is-prerelease.js I tried to explicitly set the branch to not be prerelease in my config:

 branches: [
-    { name: "main", channel: "latest" },
+    { name: "main", channel: "latest", prerelease: false },
 ]

Seems to work so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants