1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00
Edward Maxwell-Lyte 18695c2687
fix: sort tags by version not day of the week (#2377)
* fix: tag sorting

When the HEAD commit has multiple tags, they are sorted in order to select the latest so that it can be released.

However, the existing sort would not work if there were multiple commits across a Wednesday and a Thursday.

For example:

```
git tag --points-at HEAD --format='%(creatordate)%09%(refname)'
Wed Jul 28 07:13:19 2021 +0000  refs/tags/v0.0.183
Thu Jul 29 13:31:07 2021 +0000  refs/tags/v0.0.184
Thu Jul 29 13:38:42 2021 +0000  refs/tags/v0.0.185
Thu Jul 29 13:57:44 2021 +0000  refs/tags/v0.0.186
```

When using the existing sort the `creatordate` field was targeted and reversed. Alphabetically Thursday comes before Wednesday, so that is reversed and the Wednesday release always comes first:
```
git tag --points-at HEAD --sort=-version:creatordate --format='%(creatordate)%09%(refname)'
Wed Jul 28 07:13:19 2021 +0000  refs/tags/v0.0.183
Thu Jul 29 13:57:44 2021 +0000  refs/tags/v0.0.186
Thu Jul 29 13:38:42 2021 +0000  refs/tags/v0.0.185
Thu Jul 29 13:31:07 2021 +0000  refs/tags/v0.0.184
```

This would make goreleaser attempt to release that existing tag again, and fail.

If we instead sort by reversed `refname` we get the tags ordered by their numeric value, which ignore the day of the week of release:
```
git tag --points-at HEAD --sort=-version:refname --format='%(creatordate)%09%(refname)'
Thu Jul 29 13:57:44 2021 +0000  refs/tags/v0.0.186
Thu Jul 29 13:38:42 2021 +0000  refs/tags/v0.0.185
Thu Jul 29 13:31:07 2021 +0000  refs/tags/v0.0.184
Wed Jul 28 07:13:19 2021 +0000  refs/tags/v0.0.183
```

Allowing the latest version, 0.0.186 in this case, to be targeted for release.

* corrected test case

* add space

* remove space
2021-08-02 16:20:09 +00:00
2021-07-29 09:49:25 -03:00
2021-07-24 21:21:22 -03:00
2021-08-01 21:07:00 -03:00
2018-02-13 09:49:37 -02:00
2021-04-25 02:02:31 +00:00
2021-05-26 22:23:52 +00:00
2021-05-25 16:49:49 -03:00
2020-03-31 10:04:55 -03:00
2021-07-21 22:09:02 -03:00
2021-07-21 22:09:02 -03:00
2017-12-10 15:17:38 -02:00
2021-07-24 00:29:25 -03:00
2021-07-24 00:29:25 -03:00
2021-07-24 21:21:22 -03:00
2021-06-26 21:52:27 +00:00

GoReleaser Logo

GoReleaser

Deliver Go binaries as fast and easily as possible.


GoReleaser builds Go binaries for several platforms, creates a GitHub release and then pushes a Homebrew formula to a tap repository. All that wrapped in your favorite CI.

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. We appreciate your contribution. Please refer to our contributing guidelines for further information.

For questions, support and general discussion, please use GitHub Discussions;

Get GoReleaser

Documentation

Documentation is hosted live at https://goreleaser.com

Badges

Release Software License Build status Codecov branch Go Doc Powered By: GoReleaser Backers on Open Collective Sponsors on Open Collective Conventional Commits

Sponsors

Does your company use goreleaser? Help keep the project bug-free and feature rich by sponsoring the project.

Backers

Love our work and community? Become a backer.

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Stargazers over time

Stargazers over time

Languages
Go 93.4%
Nix 2.1%
Ruby 2%
YAML 1%
HTML 0.6%
Other 0.9%