go-semantic-release / semantic-release

šŸ“¦šŸš€ semantic-release written in Go
https://go-semantic-release.xyz
MIT License
409 stars 43 forks source link

maintained version is not bumped as expected #86

Open ido-namely opened 3 years ago

ido-namely commented 3 years ago

I'm using the --maintained-version flag with initial value of 2-rc /usr/local/bin/semantic-release --provider-opt "slug=<repo-name>" --no-ci -f --allow-no-changes --prerelease --maintained-version "2-rc"

[go-semantic-release]: version: 2.6.0
[go-semantic-release]: ci-condition plugin: default@1.2.0
[go-semantic-release]: provider plugin: GitHub@1.4.0
[go-semantic-release]: getting default branch...
[go-semantic-release]: found default branch: master
[go-semantic-release]: repo is private
[go-semantic-release]: found current branch: cd290683f0a83df03051f060ffc9bac993be9159
[go-semantic-release]: found maintained version: 2-rc
[go-semantic-release]: found current sha: cd290683f0a83df03051f060ffc9bac993be9159
[go-semantic-release]: getting latest release...
[go-semantic-release]: found version: 2.0.0-rc
[go-semantic-release]: getting commits...
[go-semantic-release]: commit-analyzer plugin: default@1.3.0
[go-semantic-release]: calculating new version...
[go-semantic-release]: new version: 2.0.0-rc.1
[go-semantic-release]: generating changelog...
[go-semantic-release]: changelog-generator plugin: default@1.3.1
[go-semantic-release]: creating release...
[go-semantic-release]: done.

Expected behavior: The newly created version is 2.1.0-rc.

Actual behavior: The newly created version is 2.0.0-rc.1.

I tried flipping the order and use rc-2, but that is an illegal format according to the command:

 [go-semantic-release]: improper constraint: rc-2

Thanks!

christophwitzko commented 3 years ago

Hi @ido-namely, the maintained version feature is to keep releases in a certain version range. As you pass a version range with a prerelease value (2-rc), it will stay in the prerelease version range. So the actual behavior is correct. The behavior you expect would be a different feature to set the prerelease value to a custom value.

jeraldsm commented 2 years ago

Hi @christophwitzko

I have a similar but slightly different issue, In my case, if the tag 1.x.x-rc.1 already exist and when we specify --maintained-version 1.x.x-rc, then I get an error POST https://gitlab.com/api/v4/projects/25611712/releases: 409 {message: Release already exists} and the command get terminated with exit code 1.

$ semantic-release --token ${GL_TOKEN} --version-file --allow-no-changes --prerelease --allow-maintained-version-on-default-branch --maintained-version ${CURRENT_TAG}-rc [go-semantic-release]: version: 2.18.0 [go-semantic-release]: ci-condition plugin: GitLab CI@1.4.0 [go-semantic-release]: provider plugin: GitLab@1.6.0 [go-semantic-release]: getting default branch... [go-semantic-release]: found default branch: master [go-semantic-release]: repo is private [go-semantic-release]: found current branch: test/CCNG-465 [go-semantic-release]: found maintained version: v1.5.1-rc [go-semantic-release]: found current sha: f6a230ead5fa0c213b807063dd9f3380a2a06424 [go-semantic-release]: running CI condition... [go-semantic-release]: getting latest release... [go-semantic-release]: found version: 1.5.1-rc [go-semantic-release]: getting commits... [go-semantic-release]: analyzing commits... [go-semantic-release]: commit-analyzer plugin: default@1.5.0 [go-semantic-release]: calculating new version... [go-semantic-release]: new version: 1.5.1-rc.1 [go-semantic-release]: generating changelog... [go-semantic-release]: changelog-generator plugin: default@1.7.0 [go-semantic-release]: creating release... [go-semantic-release]: POST https://gitlab.com/api/v4/projects/25611712/releases: 409 {message: Release already exists} [go-semantic-release]: stopping plugins...

I thought the actual behavior was to bump up version from 1.x.x-rc.1 to 1.x.x-rc.2, however I understand from the previous comment that maintained version will stay as it is.

Is it possible to ignore if the release already exists and pass the command with exit code 0 ?