github-tag-action icon indicating copy to clipboard operation
github-tag-action copied to clipboard

Semver not upgrading to correct version, defaulting to 0.0.1 everytime

Open bhojjoshi opened this issue 3 years ago • 4 comments

Hi, I'm using this action as below:

- name: Bump version and push tag uses: mathieudutour/[email protected] id: semver with: github_token: ${{ secrets.GITHUB_TOKEN }} dry_run: false create_annotated_tag: true append_to_pre_release_tag: ci release_branches: main,master

So far it had created three release versions from master (and many pre-release version), the latest being 1.0.3. For any new push to the master through PR, it's trying to create a new version 0.0.1 since it finds the previous_version as 0.0.0. Below is the log from one of the recent workflow run:

Run mathieudutour/[email protected] with: github_token: *** dry_run: false create_annotated_tag: true append_to_pre_release_tag: ci release_branches: main,master default_bump: patch tag_prefix: v Previous tag was 0.0.0. Analysis of 0 commits complete: no release New version is 0.0.1. New tag after applying prefix is v0.0.1. Changelog is ## 0.0.1 (2021-01-28)

bhojjoshi avatar Jan 28 '21 09:01 bhojjoshi

do you have any tag on your repo?

mathieudutour avatar Jan 28 '21 10:01 mathieudutour

do you have any tag on your repo?

Yes, there are almost 100 tags in the repositories, below are some of them: 1.0.0 1.0.1-bf27124 v0.0.1 v1.0.1-ci.0 v1.0.99-CLOUD11.0 v1.0.2 v1.0.3 //This is the latest from master and the next version supposed to be 1.0.4

bhojjoshi avatar Jan 28 '21 10:01 bhojjoshi

@mathieudutour Here's the debug output if that helps

##[debug]Evaluating condition for step: 'Bump version and push tag'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Bump version and push tag
##[debug]Loading inputs
##[debug]Evaluating: secrets.GITHUB_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GITHUB_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: steps.jira_issue_finder.outputs.jira_issue
##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating steps:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'jira_issue_finder'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'outputs'
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'jira_issue'
##[debug]=> 'ci'
##[debug]Result: 'ci'
##[debug]Loading env
Run mathieudutour/[email protected]
##[debug]Found Valid Tag: v1.0.123-cloud-27.0.
##[debug]Found Valid Tag: v1.0.122-cloud-27.0.
##[debug]Found Valid Tag: v1.0.121-cloud-27.0.
##[debug]Found Valid Tag: v1.0.120-cloud-27.0.
##[debug]Found Valid Tag: v1.0.119-cloud-27.0.
##[debug]Found Valid Tag: v1.0.118-cloud-27.0.
##[debug]Found Valid Tag: v1.0.117-cloud-27.0.
##[debug]Found Valid Tag: v1.0.116-cloud-27.0.
##[debug]Found Valid Tag: v1.0.115-cloud-27.0.
##[debug]Found Valid Tag: v1.0.64-cloud-27.0.
##[debug]Found Valid Tag: v1.0.63-cloud-27.0.
##[debug]Found Valid Tag: v1.0.62-cloud-27.0.
##[debug]Found Valid Tag: v1.0.61-cloud-27.0.
##[debug]Found Valid Tag: v1.0.60-cloud-27.0.
##[debug]Found Valid Tag: v1.0.59-cloud-27.0.
##[debug]Found Valid Tag: v1.0.58-cloud-27.0.
##[debug]Found Valid Tag: v1.0.57-cloud-27.0.
##[debug]Found Valid Tag: v1.0.56-cloud-27.0.
##[debug]Found Valid Tag: v1.0.55-cloud-27.0.
##[debug]Found Valid Tag: v1.0.54-cloud-27.0.
##[debug]Found Valid Tag: v1.0.53-cloud-27.0.
##[debug]Found Valid Tag: v1.0.52-cloud-27.0.
##[debug]Found Valid Tag: v1.0.51-cloud-27.0.
##[debug]Found Valid Tag: v1.0.50-cloud-27.0.
##[debug]Found Valid Tag: v1.0.49-cloud-27.0.
##[debug]Found Valid Tag: v1.0.48-cloud-27.0.
##[debug]Found Valid Tag: v1.0.47-cloud-27.0.
##[debug]Found Valid Tag: v1.0.46-cloud-27.0.
##[debug]Found Valid Tag: v1.0.45-cloud-27.0.
##[debug]Found Valid Tag: v1.0.44-cloud-27.0.
##[debug]Found Valid Tag: v1.0.43-cloud-27.0.
##[debug]Found Valid Tag: v1.0.42-cloud-27.0.
##[debug]Found Valid Tag: v1.0.41-cloud-27.0.
##[debug]Found Valid Tag: v1.0.40-cloud-27.0.
##[debug]Found Valid Tag: v1.0.39-cloud-27.0.
##[debug]Found Valid Tag: v1.0.38-cloud-27.0.
##[debug]Found Valid Tag: v1.0.37-cloud-27.0.
##[debug]Found Valid Tag: v1.0.36-cloud-27.0.
##[debug]Found Valid Tag: v1.0.35-cloud-27.0.
##[debug]Found Valid Tag: v1.0.34-cloud-27.0.
##[debug]Found Valid Tag: v1.0.33-cloud-27.0.
##[debug]Found Valid Tag: v1.0.32-cloud-27.0.
##[debug]Found Valid Tag: v1.0.31-cloud-27.0.
##[debug]Found Valid Tag: v1.0.30-cloud-27.0.
##[debug]Found Valid Tag: v1.0.29-cloud-27.0.
##[debug]Found Valid Tag: v1.0.28-cloud-27.0.
##[debug]Found Valid Tag: v1.0.27-cloud-27.0.
##[debug]Found Valid Tag: v1.0.26-cloud-27.0.
##[debug]Found Valid Tag: v1.0.25-cloud-27.0.
##[debug]Found Valid Tag: v1.0.24-cloud-27.0.
Previous tag was 0.0.0.
::set-output name=previous_tag::0.0.0
##[debug]steps.semver.outputs.previous_tag='0.0.0'
Analysis of 0 commits complete: no release
New version is 0.0.1.
::set-output name=new_version::0.0.1
##[debug]steps.semver.outputs.new_version='0.0.1'
New tag after applying prefix is v0.0.1.
::set-output name=new_tag::v0.0.1
##[debug]steps.semver.outputs.new_tag='v0.0.1'

I notice that it is pushing a lot of pre-release tags. Is there a way to tell this action to only push tags from the master branch? I am sure we are doing something wrong here.

NasAmin avatar Jan 29 '21 10:01 NasAmin

@NasAmin Yes, it looks like it was an issue with the "append_to_pre_release_tag" param being set for main/master branch, as I add a condition before setting it in this action, that sets it to empty string if the branch if main/master and now it's properly tagging.

@mathieudutour It still seems to be a bug as there should not be any dependency on "append_to_pre_release_tag" param while tagging from the release branch (main/master).

bhojjoshi avatar Feb 08 '21 04:02 bhojjoshi