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

pre-release options stops major version bump #207

Closed
abrondijk opened this issue Mar 28, 2023 · 4 comments
Closed

pre-release options stops major version bump #207

abrondijk opened this issue Mar 28, 2023 · 4 comments
Labels
wontfix This will not be worked on

Comments

@abrondijk
Copy link

When the option pre-release is set to true, it seems to be ignoring breaking changes.
My commit message was as following:

feat!: Test breaking change

The expected behaviour would be that the exclamation mark triggers a breaking change and thus a major version bump.
This was managed with the suggested solution in #231.

I have two actions using this action, a releaser and a pre-releaser.

Configuration

Releaser:

    steps:
      - name: Git Checkout
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0
      - name: Version number
        id: version
        uses: TriPSs/[email protected]
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          preset: 'conventionalcommits'
          skip-on-empty: 'false'
          git-push: 'false'
          skip-git-pull: 'true'
          version-file: 'version.json'

Pre-releaser:

    steps:
      - name: Git Checkout
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0
      - name: Version number
        id: version
        uses: TriPSs/[email protected]
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          preset: 'conventionalcommits'
          skip-on-empty: 'false'
          git-push: 'false'
          skip-git-pull: 'true'
          version-file: 'version.json'
          pre-release: 'true'

Logs

Pre-eleaser (was run first):

Using "conventionalcommits" preset
Using "chore(release): {version} [skip ci]" as commit message
Using "Conventional Changelog Action" as git user.name
Using "[email protected]" as git user.email
Using "5" release count
Using "version.json" as version file
Using "version" as version path
Using "v" as tag prefix
Using "false" as output file
Using "" as config file
Using "github.com" as gitUrl
Using "main" as gitBranch
Using "" as gitPath
Skipping empty releases is "disabled"
Skipping the update of the version file is "disabled"
Pull to make sure we have the full git history
/usr/bin/git config user.name Conventional Changelog Action
/usr/bin/git config user.email [email protected]
/usr/bin/git remote set-url origin ***github.com/abrondijk/VisualGDB-Test.git
/usr/bin/git rev-parse --is-shallow-repository
true
/usr/bin/git pull --unshallow --tags --ff-only
From https://github.com/abrondijk/VisualGDB-Test
 * [new branch]      cpp                  -> origin/cpp
 * [new branch]      fourth-test          -> origin/fourth-test
 * [new branch]      revert-2-second-test -> origin/revert-2-second-test
 * [new branch]      second-test          -> origin/second-test
 * [new branch]      third-test           -> origin/third-test
 * [new tag]         v0.1.0               -> v0.1.0
 * [new tag]         v0.1.1               -> v0.1.1
 * [new tag]         v0.1.2               -> v0.1.2
 * [new tag]         v0.1.3               -> v0.1.3
 * [new tag]         v0.1.4               -> v0.1.4
 * [new tag]         v0.1.5               -> v0.1.5
 * [new tag]         v0.1.6               -> v0.1.6
 * [new tag]         v0.10.0              -> v0.10.0
 * [new tag]         v0.10.1              -> v0.10.1
 * [new tag]         v0.10.2              -> v0.10.2
 * [new tag]         v0.10.3              -> v0.10.3
 * [new tag]         v0.10.3-rc.0         -> v0.10.3-rc.0
 * [new tag]         v0.2.0               -> v0.2.0
 * [new tag]         v0.3.0               -> v0.3.0
 * [new tag]         v0.4.0               -> v0.4.0
 * [new tag]         v0.4.1               -> v0.4.1
 * [new tag]         v0.5.0               -> v0.5.0
 * [new tag]         v0.6.0               -> v0.6.0
 * [new tag]         v0.7.0               -> v0.7.0
 * [new tag]         v0.8.0               -> v0.8.0
 * [new tag]         v0.8.1               -> v0.8.1
 * [new tag]         v0.8.2               -> v0.8.2
 * [new tag]         v0.9.0               -> v0.9.0
 * [new tag]         v0.9.1               -> v0.9.1
Already up to date.
Recommended release type: major
Because: There is 1 BREAKING CHANGE and 0 features
Files to bump: version.json
Bumping version to file "version.json" with extension "json"
Bumped file "/home/runner/work/VisualGDB-Test/VisualGDB-Test/version.json" from "0.10.3" to "0.10.4-rc.0"
Changelog generated
### [0.10.4-rc.0](https://github.com/abrondijk/VisualGDB-Test/compare/v0.10.3...v0.10.4-rc.0) (2023-03-28)


### ⚠ BREAKING CHANGES

* Test breaking change

### Features

* Test breaking change ([f31ca69](https://github.com/abrondijk/VisualGDB-Test/commit/f31ca69943075f77a4bf66f7484ec79136e4e69c))


### Bug Fixes

* Test fix ([a85310c](https://github.com/abrondijk/VisualGDB-Test/commit/a85310cdac8b82cbe7b2185171253999ffd061ac))


New version: 0.10.4-rc.0
/usr/bin/git add .
/usr/bin/git commit -m chore(release): v0.10.4-rc.0 [skip ci]
[main 21b09da] chore(release): v0.10.4-rc.0 [skip ci]
 1 file changed, 1 insertion(+), 1 deletion(-)
/usr/bin/git tag -a v0.10.4-rc.0 -m v0.10.4-rc.0
Push all changes
/usr/bin/git push origin main --follow-tags
To https://github.com/abrondijk/VisualGDB-Test.git
   cc4a665..21b09da  main -> main
 * [new tag]         v0.10.4-rc.0 -> v0.10.4-rc.0

Releaser:

Using "conventionalcommits" preset
Using "chore(release): {version} [skip ci]" as commit message
Using "Conventional Changelog Action" as git user.name
Using "[email protected]" as git user.email
Using "5" release count
Using "version.json" as version file
Using "version" as version path
Using "v" as tag prefix
Using "false" as output file
Using "" as config file
Using "github.com" as gitUrl
Using "main" as gitBranch
Using "" as gitPath
Skipping empty releases is "disabled"
Skipping the update of the version file is "disabled"
Pull to make sure we have the full git history
/usr/bin/git config user.name Conventional Changelog Action
/usr/bin/git config user.email [email protected]
/usr/bin/git remote set-url origin ***github.com/abrondijk/VisualGDB-Test.git
/usr/bin/git rev-parse --is-shallow-repository
true
/usr/bin/git pull --unshallow --tags --ff-only
From https://github.com/abrondijk/VisualGDB-Test
 * [new branch]      cpp                  -> origin/cpp
 * [new branch]      fourth-test          -> origin/fourth-test
 * [new branch]      revert-2-second-test -> origin/revert-2-second-test
 * [new branch]      second-test          -> origin/second-test
 * [new branch]      third-test           -> origin/third-test
 * [new tag]         v0.1.0               -> v0.1.0
 * [new tag]         v0.1.1               -> v0.1.1
 * [new tag]         v0.1.2               -> v0.1.2
 * [new tag]         v0.1.3               -> v0.1.3
 * [new tag]         v0.1.4               -> v0.1.4
 * [new tag]         v0.1.5               -> v0.1.5
 * [new tag]         v0.1.6               -> v0.1.6
 * [new tag]         v0.10.0              -> v0.10.0
 * [new tag]         v0.10.1              -> v0.10.1
 * [new tag]         v0.10.2              -> v0.10.2
 * [new tag]         v0.10.3              -> v0.10.3
 * [new tag]         v0.10.3-rc.0         -> v0.10.3-rc.0
 * [new tag]         v0.10.4-rc.0         -> v0.10.4-rc.0
 * [new tag]         v0.2.0               -> v0.2.0
 * [new tag]         v0.3.0               -> v0.3.0
 * [new tag]         v0.4.0               -> v0.4.0
 * [new tag]         v0.4.1               -> v0.4.1
 * [new tag]         v0.5.0               -> v0.5.0
 * [new tag]         v0.6.0               -> v0.6.0
 * [new tag]         v0.7.0               -> v0.7.0
 * [new tag]         v0.8.0               -> v0.8.0
 * [new tag]         v0.8.1               -> v0.8.1
 * [new tag]         v0.8.2               -> v0.8.2
 * [new tag]         v0.9.0               -> v0.9.0
 * [new tag]         v0.9.1               -> v0.9.1
Already up to date.
Recommended release type: major
Because: There is 1 BREAKING CHANGE and 0 features
Files to bump: version.json
Bumping version to file "version.json" with extension "json"
Bumped file "/home/runner/work/VisualGDB-Test/VisualGDB-Test/version.json" from "0.10.4-rc.0" to "1.0.0"
Changelog generated
## [1.0.0](https://github.com/abrondijk/VisualGDB-Test/compare/v0.10.3...v1.0.0) (2023-03-28)

### 0.10.4-rc.0 (2023-03-28)


### ⚠ BREAKING CHANGES

* Test breaking change

### Features

* Test breaking change ([f31ca69](https://github.com/abrondijk/VisualGDB-Test/commit/f31ca69943075f77a4bf66f7484ec79136e4e69c))


### Bug Fixes

* Test fix ([a85310c](https://github.com/abrondijk/VisualGDB-Test/commit/a85310cdac8b82cbe7b2185171253999ffd061ac))


New version: 1.0.0
/usr/bin/git add .
/usr/bin/git commit -m chore(release): v1.0.0 [skip ci]
[main 840b383] chore(release): v1.0.0 [skip ci]
 1 file changed, 1 insertion(+), 1 deletion(-)
/usr/bin/git tag -a v1.0.0 -m v1.0.0
Push all changes
/usr/bin/git push origin main --follow-tags
To https://github.com/abrondijk/VisualGDB-Test.git
   21b09da..840b383  main -> main
 * [new tag]         v1.0.0 -> v1.0.0

As the logs of the pre-releaser suggest, the exclamation mark does trigger a major version increase, but it uses a patch increase anyway:

Recommended release type: major
Because: There is 1 BREAKING CHANGE and 0 features
Files to bump: version.json
Bumping version to file "version.json" with extension "json"
Bumped file "/home/runner/work/VisualGDB-Test/VisualGDB-Test/version.json" from "0.10.3" to "0.10.4-rc.0"

Whereas the releaser prints basically the same logs but does actually bumps the major version.
What gives?

@abrondijk abrondijk changed the title pre-release options stops major version bumps pre-release options stops major version bump Mar 28, 2023
@TriPSs
Copy link
Owner

TriPSs commented Mar 28, 2023

I think when using pre-releases everything becomes a patch version? I'm not 100% sure here what the correct flow is.

Maybe @DevScyu can tell you more as he also build the functionality.

@abrondijk
Copy link
Author

That does seem to be the case, judging by this line and the function it is calling:

newVersion = semver.inc(version, (prerelease ? 'prerelease' : releaseType), identifier)

https://github.com/TriPSs/conventional-changelog-action/blob/releases/v3/node_modules/semver/classes/semver.js#L178-L284

I'm not sure if this is desired?
At least to me it doesn't make sense for the pre-release of a new major version, to have a different major release number.

@ygrishajev
Copy link

More intuitive way seems to be that pre-release is the same as a following release. So the main (non-prerelease part of a pre-release tag) should follow same rules as the release one. E.g.

2.0.0-rc.0 # is a release candidate for upcoming one
2.0.0

This should be a pretty valid use-case as well:
1.8.0-rc.0
1.8.1-rc.0
1.9.0-rc.0
2.0.0-rc.0
2.0.0

As preparing next release it may include just a bug fix, then introduce a feature and suddenly it may be that it's not possible to release without breaking changes.

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 17, 2023
@stale stale bot closed this as completed Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants