K-Phoen / semver-release-action

GitHub Action to automatically create SemVer compliant releases based on PR labels.
MIT License
85 stars 38 forks source link

custom tag_format not used to parse existing tags in latest-tag command #34

Open matthewbpt opened 4 years ago

matthewbpt commented 4 years ago

On our repository we've been using the format release-%major%.%minor%.%patch% for our releases. I tried to introduce your action so we could auto tag and release instead of our current manual process, but it doesn't work correctly with our format, eg always creates tag release-0.1.0 for a minor release, despite us already having many tags above that.

I had a look at the code and it seems this logic is missing here https://github.com/K-Phoen/semver-release-action/blob/master/internal/pkg/git/git.go but I'm not so familiar with Go myself to attempt a fix and PR myself.

shadycuz commented 4 years ago

@matthewbpt I'm about to try a similar workflow and found your issue and was a bit worried. I read through the code and I do think it will work fine.

The problem you are having is that your tags do not meet the semver specifications. The problem is that you shouldn't have anything in front of the semver string. The function this action uses to parse the tags is documented here. You can see it can handle a "v" and extra leading "0" like 01.2.5 but not much else.

What I would recommend is for your release tag stick to just v{major}.{minor}.{patch} and for anything else v{major}.{minor}.{patch}-{EXTRA-Stuff}.

krogon commented 3 months ago

similar to: https://github.com/K-Phoen/semver-release-action/issues/43

krogon commented 3 months ago

Respecting tag_format fix is available on my fork (v2.3.0 version).