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

goreleaser attempt to release an existing tag and fail #3609

Closed
3 tasks done
Lyndon-Li opened this issue Nov 30, 2022 · 8 comments · Fixed by #3611
Closed
3 tasks done

goreleaser attempt to release an existing tag and fail #3609

Lyndon-Li opened this issue Nov 30, 2022 · 8 comments · Fixed by #3611
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Lyndon-Li
Copy link

Lyndon-Li commented Nov 30, 2022

What happened?

Due to the change in this PR, when there is a pre-release, the command git tag --points-at HEAD --sort -version:refname generates below result, from which goreleaser picks v1.10.0-rc.2 to create the release. It is expected to pick v1.10.0, and v1.10.0-rc.2 has been released:

git tag --points-at HEAD  --sort -version:refname
v1.10.0-rc.2
v1.10.0

How can we reproduce this?

Release one pre-release, for example, v1.10.0-rc.2
Don't make any new commit so as to keep the HEAD unchanged
Create a GA release, for example, v1.10.0
[Result] The second release fails

goreleaser version

1.13.1

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@Lyndon-Li Lyndon-Li added bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 30, 2022
@Lyndon-Li Lyndon-Li changed the title goreleaser attempt to release that existing tag and fail goreleaser attempt to release an existing tag and fail Nov 30, 2022
@caarlos0
Copy link
Member

hmm, will see what I can do... as a workaround you can set GORELEASER_CURRENT_TAG environment variable to the version you want for this release...

@Lyndon-Li
Copy link
Author

Thanks, the workaround should work, meanwhile please help to check if this problem can be fixed in any of the new releases.

@caarlos0
Copy link
Member

it might not be possible to fix.

@caarlos0
Copy link
Member

explaining: if I revert that commit, it'll break somewhere else... and it seems like git cant sort by multiple fields and does not take the semantic version fields into consideration (it seems).

what we might be able to do is add a config for the sorting, so its the user responsibility.

But its more of a feature than a bug...

@Lyndon-Li
Copy link
Author

This command git tag --points-at HEAD --sort=v:refname could return the correct result in this scenario, but not sure if it meets others requirements.

@caarlos0
Copy link
Member

nope, that would return v0.0.1 instead of v0.0.2, for example...

@caarlos0
Copy link
Member

another idea would be to use git config --get tag.sort if set, defaulting to the current behavior... so users could set it per repo... but I guess having it in the yaml is likely better. either way, will look into it tomorrow.

@caarlos0 caarlos0 added enhancement New feature or request and removed bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 30, 2022
@caarlos0 caarlos0 added this to the v1.14.0 milestone Nov 30, 2022
@caarlos0
Copy link
Member

please check #3611

caarlos0 added a commit that referenced this issue Dec 3, 2022
closes #3609

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants