goreleaser: goreleaser fails because of alphabetical tag sort
Describe the bug
If there are old tags that start with the letter ‘y’ or ‘z’, goreleaser will fail with this error.
release failed after 0.10s error=git tag y-tag was not made against commit <latest-commit>
goreleaser enforces semver, so normally all newer tags will start with the letter ‘v’ or with a number. Thus it will always be alphabetically sorted below those tags.
Further more if we have tags like v0.0.1 and then 0.0.2(without the ‘v’ in the tag), alphabetically v0.0.1 will be first. Both are valid semvers
To Reproduce
Create a tag starting with letter ‘y’ or ‘z’. In latter commits, create tags with semver. Run goreleaser release
.
Environment (please complete the following information):
- OS: mac
- OS version: Darwin Ninan-2.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
- GoReleaser Version: 0.120.1
Additional Notes:
This is becaue of the addition of -c versionsort.suffix=- tag -l --sort=-v:refname
in the process of finding latest tag.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 24 (20 by maintainers)
git tag --sort=-creatordate
returns:Is this conversation continued somewhere else? Any status on the fix?
FWIW, using go-git, something like this seems to work:
Not sure if
v
is required for a valid semver or not. But goreleaser considers both as valid. The docs only say the prefix v is not mandatory.