Replies: 8 comments 1 reply
-
Yes, or more specifically it always looks at the current HEAD unless you set the branch explicitly (not recommended 99% of the time). So "current" is found using
If it looked at the entire repository you'd get some very strange behavior, especially when re-running older builds. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. It's an awesome action. Will each branch start with 0.0.1? I assume no, as it could cause scmtag exists issue. How to support this case using this action? |
Beta Was this translation helpful? Give feedback.
-
Thanks, yes, there is a new branch support feature just added a few weeks ago (#76). The term branches in this context can be a bit overloaded so let me define these first:
What the In this way you would be able to do things like merge a bug fix into multiple version branches without worrying about the tags present in the commit log for other versions or commit messages causing a conflict with another already published version. You should tag the commit where that branch is first created in order to get reliable increment numbers, otherwise the action won't know how far back a particular version branch forked from the main trunk, and continue to tag commits when you release them the same as you would without branch support enabled since the action will still look for tags matching the branch version. Note that in your example it seems that you are specifying the patch as part of the branch name, is the major version supposed to be 2023? If you enable |
Beta Was this translation helpful? Give feedback.
-
The problem I am facing is when I create tags from feature branches. Same tags are getting created from both feature branches and my pipeline is failing with error SCM tag already exists. How do I get past this? Use case is to be able to create tags from different feature branches but follow semantic versioning for the repository |
Beta Was this translation helpful? Give feedback.
-
Well the tags need to be unique, I'm not sure what you're using exactly though. What I mean is imagine you are on master and you are releasing a new version, say Some time goes by and you want to release an update. You're still on branch After you've released Using branches for versioning is quite an advance use case, most people will not need. I am in the process of writing up a guide which includes a section on choosing a versioning strategy. It is still a work in progress, but might be helpful. |
Beta Was this translation helpful? Give feedback.
-
Hi, I actually have the same question, but I'm not quite understand your explanation above.
This command will only list the tags reachable from Could you also elaborate on this, please?
Why would we have strange behaviour? My use case is: feature branches will be created, and once a feature is done, the feature branch will be merged back to the main branch, producing a release. There is only one series of version numbers. |
Beta Was this translation helpful? Give feedback.
-
Well yes. Maybe I can add some detection for this and print a friendly warning or something.
You'd randomly pick up versions jumping ahead depending on how other branches had been tagged, the latest version would always be selected. This commit is quite likely not even an ancestor of the current HEAD, so how do we get the commits between them? If you went back and reran a previous build, you'd be trying to use a different tag as the previous tag, etc. Based on the use case you described you do not need to use the version from branch feature at all, this is an advanced feature intended only for maintaining ongoing updates to previous versions. One thing you may wish to do is to use the branch name or commit hash as part of the version (e.g. e.g. env:
VERSION: ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}-${{ github.head_ref }}+${{steps.version.outputs.increment}} This will prevent version conflicts if you have two branches running at the same time which have the same number of commits since the last version tag, which may or may not be a problem for you depending on what else you are doing. I am going to change this to a conversation, if there's a bug or feature request please open a new issue for it. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the answer.
I would say, this strange behaviour you described is actually what I want. Say
You mean some people would want to reran a previous build, and also wants to get the same tag, rather than a different new tag? Is it fair to say that "wanting to generate the same tag when rerunning a previous build" leads to this design decision? Not to question it, but just curious, because searching tags only from the branch is a bit unexpected for me. To me, it is more "natural" and intuitive to search through the whole collections of tags. |
Beta Was this translation helpful? Give feedback.
-
v5.3.0 always looks for tags created from the branch.
By default it should consider last matching tag on the repo. Right now it's always making an increment to tag from the particular branch.
Is this expected behaviour?
Beta Was this translation helpful? Give feedback.
All reactions