1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/pipe
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
..
announce feat: announce to twitter (#2248) 2021-05-25 00:19:06 -03:00
archive chore: gofumpt 2021-07-23 23:54:13 -03:00
artifactory chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
before feat: moving some cmd logs to debug (#2359) 2021-07-23 12:09:29 +01:00
blob chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
brew fix(brew): depends_on arch 2021-05-31 16:44:58 +00:00
build feat: moving some cmd logs to debug (#2359) 2021-07-23 12:09:29 +01:00
changelog feat: template release notes (#2242) 2021-05-21 21:07:47 -03:00
checksums chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
custompublishers fix: improve output a bit (#2174) 2021-04-19 09:31:57 -03:00
defaults feat: file mappings in archives (#2347) 2021-07-21 22:09:02 -03:00
dist chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
docker fix: return an err with stdout/err when a command failed (#2363) 2021-07-24 21:32:04 -03:00
effectiveconfig chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
env fix: env templates 2021-06-04 18:11:29 +00:00
git fix: sort tags by version not day of the week (#2377) 2021-08-02 16:20:09 +00:00
gomod fix: fd leak on gomod pipe (#2188) 2021-04-25 00:08:58 -03:00
milestone chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
nfpm feat: remove some nfpm deprecated options (#2315) 2021-06-26 16:52:18 -03:00
project chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
publish chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
release test: header/footer invalid templates 2021-07-03 19:23:51 +00:00
scoop feat: scoop formula path 2021-06-26 17:14:42 +00:00
semver fix: log semver errors when snapshot (#2084) 2021-03-01 14:18:57 -03:00
sign fix: return an err with stdout/err when a command failed (#2363) 2021-07-24 21:32:04 -03:00
snapcraft fix: return an err with stdout/err when a command failed (#2363) 2021-07-24 21:32:04 -03:00
snapshot feat: inc parts of semver, change snapshot default name (#2358) 2021-07-24 10:13:05 -03:00
sourcearchive chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
twitter feat: --skip-announce (#2249) 2021-05-25 00:45:59 -03:00
upload chore: gofumpt & lint (#2190) 2021-04-25 14:20:49 -03:00
pipe_test.go fix: improve output a bit (#2174) 2021-04-19 09:31:57 -03:00
pipe.go feat: --skip-announce (#2249) 2021-05-25 00:45:59 -03:00