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

Wrong version bumping while digit count increasing. #166

Closed
IATkachenko opened this issue Jul 2, 2022 · 17 comments · Fixed by #244
Closed

Wrong version bumping while digit count increasing. #166

IATkachenko opened this issue Jul 2, 2022 · 17 comments · Fixed by #244
Labels
bug Something isn't working

Comments

@IATkachenko
Copy link

From action point of view, after version v0.10.0 we should use v0.9.2 tag for next version:

...
 /usr/bin/git pull --unshallow --tags --ff-only
From https://github.com/IATkachenko/HA-YandexWeather
 * [new tag]         v0.1.0     -> v0.1.0
 * [new tag]         v0.10.0    -> v0.10.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.4.2     -> v0.4.2
 * [new tag]         v0.4.3     -> v0.4.3
 * [new tag]         v0.4.4     -> v0.4.4
 * [new tag]         v0.5.0     -> v0.5.0
 * [new tag]         v0.5.1     -> v0.5.1
 * [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.9.0     -> v0.9.0
 * [new tag]         v0.9.1     -> v0.9.1
Already up to date.
Recommended release type: patch
Because: There are 0 BREAKING CHANGES and 0 features
Using GIT to determine the new version
Changelog generated
## [0.9.2](https://github.com/IATkachenko/HA-YandexWeather/compare/v0.9.1...v0.9.2) (2022-07-02)
...

So, I have to remove all previous releases to release v0.10.1

Workflow config is:

jobs:
  changes:
    name: "Create changelog and tag"
    runs-on: ubuntu-latest
    outputs:
      skipped: ${{ steps.changelog.outputs.skipped }}
      clean_changelog: ${{ steps.changelog.outputs.clean_changelog }}
      tag: ${{ steps.changelog.outputs.tag }}

    steps:
      - name: checkout
        uses: actions/checkout@v2
        id: checkout

      - name: Conventional Changelog Action
        id: changelog
        uses: TriPSs/conventional-changelog-action@v3
        with:
          github-token: ${{ secrets.github_token }}
          output-file: "false"
          skip-version-file: "true"
          skip-commit: "true"
@TriPSs
Copy link
Owner

TriPSs commented Jul 3, 2022

So if i see it correctly it should have bumped to v0.10.1 right?

@IATkachenko
Copy link
Author

IATkachenko commented Jul 3, 2022

Right.
New version should be v0.10.1, not v0.9.2.

@TriPSs
Copy link
Owner

TriPSs commented Jul 8, 2022

Could you provide the full log of the action?

@IATkachenko
Copy link
Author

IATkachenko commented Jul 8, 2022

Sure

Run TriPSs/conventional-changelog-action@v3
  with:
    github-token: ***
    output-file: false
    skip-version-file: true
    skip-commit: true
    git-message: chore(release): {version}
    git-user-name: Conventional Changelog Action
    git-user-email: conventional.changelog.action@github.com
    git-pull-method: --ff-only
    git-push: true
    preset: angular
    tag-prefix: v
    release-count: 5
    version-file: ./package.json
    version-path: version
    skip-git-pull: false
    skip-on-empty: true
    fallback-version: 0.1.0
    git-url: github.com
    skip-ci: true
    create-summary: false
Using "angular" preset
Using "chore(release): {version} [skip ci]" as commit message
Using "Conventional Changelog Action" as git user.name
Using "conventional.changelog.action@github.com" as git user.email
Using "5" release count
Using "./package.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
Skipping empty releases is "enabled"
Skipping the update of the version file is "enabled"
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 conventional.changelog.action@github.com
/usr/bin/git remote set-url origin ***github.com/IATkachenko/HA-YandexWeather.git
/usr/bin/git rev-parse --is-shallow-repository
true
/usr/bin/git pull --unshallow --tags --ff-only
From https://github.com/IATkachenko/HA-YandexWeather
 * [new tag]         v0.1.0     -> v0.1.0
 * [new tag]         v0.10.0    -> v0.10.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.4.2     -> v0.4.2
 * [new tag]         v0.4.3     -> v0.4.3
 * [new tag]         v0.4.4     -> v0.4.4
 * [new tag]         v0.5.0     -> v0.5.0
 * [new tag]         v0.5.1     -> v0.5.1
 * [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.9.0     -> v0.9.0
 * [new tag]         v0.9.1     -> v0.9.1
Already up to date.
Recommended release type: patch
Because: There are 0 BREAKING CHANGES and 0 features
Using GIT to determine the new version
Changelog generated
## [0.9.2](https://github.com/IATkachenko/HA-YandexWeather/compare/v0.9.1...v0.9.2) (2022-07-02)
### Bug Fixes
* avoid crashes while HA restart before first update while initial setup ([38bfe30](https://github.com/IATkachenko/HA-YandexWeather/commit/38bfe304aab743eb0a639938b94d991b68685f0b)), closes [#33](https://github.com/IATkachenko/HA-YandexWeather/issues/33)
* **HACS:** remove extra key from hacs.json ([5fec7b3](https://github.com/IATkachenko/HA-YandexWeather/commit/5fec7b337f4e4c6b0fba20074c7b988e6d314e09))
New version: 0.9.2
/usr/bin/git tag -a v0.9.2 -m v0.9.2
Push all changes
/usr/bin/git push origin main --follow-tags
To https://github.com/IATkachenko/HA-YandexWeather.git
 * [new tag]         v0.9.2 -> v0.9.2

@TriPSs
Copy link
Owner

TriPSs commented Jul 9, 2022

Who created the v0.10.0 tag? How it looks like is that the latest tag is v0.9.1 so thats why it's using that tag.

@IATkachenko
Copy link
Author

v0.10.0 was created by the action too:

Run TriPSs/conventional-changelog-action@v3
  with:
    github-token: ***
    output-file: false
    skip-version-file: true
    skip-commit: true
    git-message: chore(release): {version}
    git-user-name: Conventional Changelog Action
    git-user-email: conventional.changelog.action@github.com
    git-pull-method: --ff-only
    git-push: true
    preset: angular
    tag-prefix: v
    release-count: 5
    version-file: ./package.json
    version-path: version
    skip-git-pull: false
    skip-on-empty: true
    fallback-version: 0.1.0
Using "angular" preset
Using "chore(release): {version}" as commit message
Using "Conventional Changelog Action" as git user.name
Using "conventional.changelog.action@github.com" as git user.email
Using "5" release count
Using "./package.json" as version file
Using "version" as version path
Using "v" as tag prefix
Using "false" as output file
Using "" as config file
Skipping empty releases is "enabled"
Skipping the update of the version file is "enabled"
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 conventional.changelog.action@github.com
/usr/bin/git remote set-url origin ***github.com/IATkachenko/HA-YandexWeather.git
/usr/bin/git rev-parse --is-shallow-repository
true
/usr/bin/git pull --unshallow --tags --ff-only
From https://github.com/IATkachenko/HA-YandexWeather
 * [new branch]      dev        -> origin/dev
 * [new tag]         v0.1.0     -> v0.1.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.4.2     -> v0.4.2
 * [new tag]         v0.4.3     -> v0.4.3
 * [new tag]         v0.4.4     -> v0.4.4
 * [new tag]         v0.5.0     -> v0.5.0
 * [new tag]         v0.5.1     -> v0.5.1
 * [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.9.0     -> v0.9.0
Already up to date.
Recommended release type: minor
Because: There are 0 BREAKING CHANGES and 1 features
Using GIT to determine the new version
Changelog generated
# [0.10.0](https://github.com/IATkachenko/HA-YandexWeather/compare/v0.9.0...v0.10.0) (2022-05-21)
### Features
* **weather:** use configurable weather condition state pictures ([94c7b60](https://github.com/IATkachenko/HA-YandexWeather/commit/94c7b6048c59b25c64b283a7508b3ea0312de4d9)), closes [#30](https://github.com/IATkachenko/HA-YandexWeather/issues/30)
New version: 0.10.0
/usr/bin/git tag -a v0.10.0 -m v0.10.0
Push all changes
/usr/bin/git push origin main --follow-tags
To https://github.com/IATkachenko/HA-YandexWeather.git
 * [new tag]         v0.10.0 -> v0.10.0

It's look like the integration use last row from git pull --unshallow --tags --ff-only to get latest tag.
But git sort tags as strings: str(1) < str(9), str(100) < str(9) and so on.

The action should sort tags as versions, and only after this get the last as latest version.

@TriPSs
Copy link
Owner

TriPSs commented Sep 6, 2022

git-semver-tags is used to get all the tags, this should return the tags in order of creation, apparently that is not so so I think we need to sort the fetched tags ourself and then get the highest one.

@TriPSs TriPSs added the bug Something isn't working label Sep 6, 2022
@stale
Copy link

stale bot commented Nov 12, 2022

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 Nov 12, 2022
@IATkachenko
Copy link
Author

/unstale

@stale stale bot removed the wontfix This will not be worked on label Nov 12, 2022
@bencat-sixense
Copy link

Hi there, any news about it ?
Thanks :)

@joshuasimon-taulia
Copy link

I'm seeing the same issue on an action repo that pushes a v1 tag as well as the vx.x.x semver tag on release

@TriPSs
Copy link
Owner

TriPSs commented Mar 15, 2023

@bencat-sixense @joshuasimon-taulia would any of you be open to create a PR that will sort the tags?

@joshuasimon-taulia
Copy link

joshuasimon-taulia commented Mar 17, 2023

my CI/merge pipeline was opinionated toward pushing commits to each new git tag which don't exist on the main branch. removing this logic and only tagging the commit from the main branch seems to have solved my issue.

i was able to debug locally by using a combination of

git fetch --tags -f
git tag -fa v1.2.1 main -m "chore: release 1.2.1"
npm install -g git-semver-tags
git-semver-tags

and

git log --decorate |grep tag

@IATkachenko you might be experiencing the same issue because of the additional commit/tagging logic in your workflow

@mohed
Copy link

mohed commented Mar 27, 2023

I am experiencing the same issue.

Here is a truncated list of my tags

attendant-2.6.14
attendant-2.7.0
attendant-rc2.10.0
attendant-rc2.11.0
attendant-rc2.12.0
attendant-rc2.13.0
attendant-rc2.14.0

and here is the log from the action

Run TriPSs/conventional-changelog-action@v3
  with:
    github-token: ***
    preset: angular
    skip-on-empty: false
    skip-version-file: true
    skip-commit: true
    tag-prefix: attendant-
    git-message: chore(release): {version}
    git-user-name: Conventional Changelog Action
    git-user-email: conventional.changelog.action@github.com
    git-pull-method: --ff-only
    git-push: true
    git-branch: refs/heads/master
    output-file: CHANGELOG.md
    release-count: 5
    version-file: ./package.json
    version-path: version
    skip-git-pull: false
    skip-tag: false
    git-url: github.com
    skip-ci: true
    create-summary: false
    pre-release: false
    pre-release-identifier: rc
Using "angular" preset
Using "chore(release): {version} [skip ci]" as commit message
Using "Conventional Changelog Action" as git user.name
Using "conventional.changelog.action@github.com" as git user.email
Using "5" release count
Using "./package.json" as version file
Using "version" as version path
Using "attendant-" as tag prefix
Using "CHANGELOG.md" as output file
Using "" as config file
Using "github.com" as gitUrl
Using "master" as gitBranch
Using "" as gitPath
Skipping empty releases is "disabled"
Skipping the update of the version file is "enabled"
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 conventional.changelog.action@github.com
/usr/bin/git remote set-url origin ***github.com/org/repo.git
/usr/bin/git rev-parse --is-shallow-repository
false
/usr/bin/git pull --tags --ff-only
Already up to date.
Recommended release type: minor
Because: There are 0 BREAKING CHANGES and 38 features
Using GIT to determine the new version
Changelog generated
# [[2](https://github.com/org/repo/actions/runs/4532765370/jobs/7984639369#step:3:2).7.0](https://github.com/org/repo/compare/attendant-2.6.14...attendant-2.7.0) (202[3](https://github.com/org/repo/actions/runs/4532765370/jobs/7984639369#step:3:3)-03-27)


### Bug Fixes

* **DMTCS-1178:**  
* **DMTCS-1179:**
* removed actually commit log  


New version: 2.7.0
/usr/bin/git tag -a attendant-2.7.0 -m attendant-2.7.0
fatal: tag 'attendant-2.7.0' already exists
Unhandled Rejection occurred. Error: The process '/usr/bin/git' failed with exit code 128
    at ExecState._setResult (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:469:[27](https://github.com/org/repo//actions/runs/4532765370/jobs/7984639369#step:3:28))
Error: Unhandled Rejection occurred. Error: The process '/usr/bin/git' failed with exit code 1[28](https://github.com/org/repo/actions/runs/4532765370/jobs/7984639369#step:3:29)
    at ExecState._setResult (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/TriPSs/conventional-changelog-action/v3/node_modules/@actions/exec/lib/toolrunner.js:469:27)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:[30](https://github.com/org/repo/actions/runs/4532765370/jobs/7984639369#step:3:31)2:5)
    at ChildProcess.emit (node:events:[52](https://github.com/org/repo/actions/runs/4532765370/jobs/7984639369#step:3:53)7:28)
    at maybeClose (node:internal/child_process:10[92](https://github.com/org/repo/actions/runs/4532765370/jobs/7984639369#step:3:93):16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

I cleaned the action output a little but in principal it should contain all the information./

@mohed
Copy link

mohed commented Jun 8, 2023

Are there no plans to take a stab on this issue?

@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
@TriPSs TriPSs reopened this Dec 28, 2023
@stale stale bot removed the wontfix This will not be worked on label Dec 28, 2023
TriPSs added a commit that referenced this issue Dec 28, 2023
Fixes #166

BREAKING CHANGE: Updated major version of packages
TriPSs added a commit that referenced this issue Dec 28, 2023
Fixes #166

BREAKING CHANGE: Updated major version of packages
@TriPSs TriPSs linked a pull request Dec 28, 2023 that will close this issue
TriPSs added a commit that referenced this issue Dec 28, 2023
Fixes #166

BREAKING CHANGE: Updated major version of packages
@TriPSs
Copy link
Owner

TriPSs commented Dec 28, 2023

This issue should now be fixed in v5, git-semver-tags updated their code to sort the tags on date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants