This is technically more related to goreleaser itself and not the action, however I think reporting it under the action repo still makes sense due to the type of bug.
I've got a workflow setup so when I push to any tag, it will automatically build and release it on GitHub:
https://github.com/lrstanley/links/blob/master/.github/workflows/release.yml
However, there is a problem where if I tag the same commit twice (i.e. triggering it to rebuild the code with a different Go version as an example), it still only picks the FIRST tag that relates to that commit.
As you can see in the following build output (I've since deleted the new v0.5.3 tag, but this log still exists), you can see GitHub sees the new tag, and it clones the git repository down with that tag, however goreleaser is still using the v0.5.2 tag:
https://github.com/lrstanley/links/runs/1392634281?check_suite_focus=true
That is likely due to goreleaser using the following command (or something similar):
$ git describe --tags a1d277ff3b61a39d61f1ed135c97643ad054d8aa
v0.5.2
However, we can see with the following command, that two tags actually relate to the commit:
$ git tag --contains a1d277ff3b61a39d61f1ed135c97643ad054d8aa
v0.5.2
v0.5.3
You may wonder why I am even retagging the same commit. This is because there isn't a super easy way of automating goreleaser to rebuild, retag, and release the same code, but with a newer version of Go, at least with GitHub actions today. If the code doesn't need to be changed, there isn't really any kind of commit that needs to happen, to qualify for goreleaser to pick it up.
- Is there a way I can pass the specific tag to be used to goreleaser, via this action, since it doesn't use what
actions/checkout
is providing? Or, is there a way goreleaser can notice that actions/checkout
checked out a specific tag, and use that tag?
- Does it make sense for goreleaser to use the first tag that relates to the commit, not the latest tag that relates to the commit, by default?
Logs from actions/checkout
...:
2020-11-12T20:30:33.2634625Z ##[group]Fetching the repository
2020-11-12T20:30:33.2645932Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
[...]
2020-11-12T20:30:34.1552511Z Resolving deltas: 100% (455/455), done.
2020-11-12T20:30:34.1553020Z From https://github.com/lrstanley/links
2020-11-12T20:30:34.1554275Z * [new branch] master -> origin/master
2020-11-12T20:30:34.1555089Z * [new tag] v0.1.0 -> v0.1.0
2020-11-12T20:30:34.1555846Z * [new tag] v0.1.1 -> v0.1.1
2020-11-12T20:30:34.1556577Z * [new tag] v0.2.0 -> v0.2.0
2020-11-12T20:30:34.1557245Z * [new tag] v0.2.1 -> v0.2.1
2020-11-12T20:30:34.1558021Z * [new tag] v0.2.2 -> v0.2.2
2020-11-12T20:30:34.1558814Z * [new tag] v0.2.3 -> v0.2.3
2020-11-12T20:30:34.1559555Z * [new tag] v0.2.4 -> v0.2.4
2020-11-12T20:30:34.1560275Z * [new tag] v0.2.5 -> v0.2.5
2020-11-12T20:30:34.1561010Z * [new tag] v0.3.0 -> v0.3.0
2020-11-12T20:30:34.1561719Z * [new tag] v0.3.1 -> v0.3.1
2020-11-12T20:30:34.1562630Z * [new tag] v0.3.2 -> v0.3.2
2020-11-12T20:30:34.1563381Z * [new tag] v0.4.0 -> v0.4.0
2020-11-12T20:30:34.1564117Z * [new tag] v0.4.1 -> v0.4.1
2020-11-12T20:30:34.1564900Z * [new tag] v0.4.2 -> v0.4.2
2020-11-12T20:30:34.1565648Z * [new tag] v0.4.3 -> v0.4.3
2020-11-12T20:30:34.1566361Z * [new tag] v0.4.4 -> v0.4.4
2020-11-12T20:30:34.1567087Z * [new tag] v0.4.5 -> v0.4.5
2020-11-12T20:30:34.1567804Z * [new tag] v0.5.0 -> v0.5.0
2020-11-12T20:30:34.1568541Z * [new tag] v0.5.1 -> v0.5.1
2020-11-12T20:30:34.1569223Z * [new tag] v0.5.2 -> v0.5.2
2020-11-12T20:30:34.1569955Z * [new tag] v0.5.3 -> v0.5.3
2020-11-12T20:30:34.1570719Z [command]/usr/bin/git tag --list v0.5.3
2020-11-12T20:30:34.1571300Z v0.5.3
2020-11-12T20:30:34.1572053Z [command]/usr/bin/git rev-parse refs/tags/v0.5.3
2020-11-12T20:30:34.1572842Z a1d277ff3b61a39d61f1ed135c97643ad054d8aa
2020-11-12T20:30:34.1574117Z ##[endgroup]
2020-11-12T20:30:34.1574815Z ##[group]Determining the checkout info
2020-11-12T20:30:34.1575412Z ##[endgroup]
2020-11-12T20:30:34.1575954Z ##[group]Checking out the ref
2020-11-12T20:30:34.1576891Z [command]/usr/bin/git checkout --progress --force refs/tags/v0.5.3
2020-11-12T20:30:34.1577859Z Note: switching to 'refs/tags/v0.5.3'.
[...]
2020-11-12T20:30:34.1587959Z HEAD is now at a1d277f fix: behind-proxy used on incorrect router
2020-11-12T20:30:34.1588482Z ##[endgroup]
2020-11-12T20:30:34.1589115Z [command]/usr/bin/git log -1 --format='%H'
2020-11-12T20:30:34.1590208Z 'a1d277ff3b61a39d61f1ed135c97643ad054d8aa'
Logs from goreleaser
:
/opt/hostedtoolcache/goreleaser-action/0.147.0/x64/goreleaser release --rm-dist --skip-validate --release-header=notes-header.md --release-footer=notes-footer.md
• releasing...
• loading config file file=.goreleaser.yml
• loading environment variables
• getting and validating git state
• releasing v0.5.2, commit a1d277ff3b61a39d61f1ed135c97643ad054d8aa
• pipe skipped error=validation is disabled
• parsing tag
• running before hooks
• setting defaults
• snapshotting
• github/gitlab/gitea releases
• project name
• building binaries
• creating source archive
• archives
• linux packages
• snapcraft packages
• calculating checksums
• signing artifacts
• docker images
• artifactory
• blobs
• homebrew tap formula
• scoop manifests
• milestones
• snapshotting
• pipe skipped error=not a snapshot
• checking ./dist
• writing effective config file
• writing config=dist/config.yaml
• generating changelog
• writing changelog=dist/CHANGELOG.md
• building binaries
• building binary=/home/runner/work/links/links/dist/links_freebsd_amd64/links
• building binary=/home/runner/work/links/links/dist/links_linux_amd64/links
• building binary=/home/runner/work/links/links/dist/links_windows_amd64/links.exe
• archives
• creating archive=dist/links_0.5.2_freebsd_amd64.tar.gz
• creating archive=dist/links_0.5.2_linux_amd64.tar.gz
• creating archive=dist/links_0.5.2_windows_amd64.zip
• creating source archive
• pipe skipped error=source pipe is disabled
• linux packages
• creating file=dist/links_0.5.2_linux_amd64.rpm
• creating file=dist/links_0.5.2_linux_amd64.deb
• snapcraft packages
• calculating checksums
• checksumming file=links_0.5.2_linux_amd64.rpm
• checksumming file=links_0.5.2_windows_amd64.zip
• checksumming file=links_0.5.2_freebsd_amd64.tar.gz
• checksumming file=links_0.5.2_linux_amd64.deb
• checksumming file=links_0.5.2_linux_amd64.tar.gz
• signing artifacts
• docker images
• pipe skipped error=docker section is not configured
• publishing
• blobs
• pipe skipped error=blobs section is not configured
• http upload
• pipe skipped error=uploads section is not configured
• custom publisher
• pipe skipped error=publishers section is not configured
• artifactory
• pipe skipped error=artifactory section is not configured
• docker images
• snapcraft packages
• github/gitlab/gitea releases
• creating or updating release repo=lrstanley/links tag=v0.5.2
• release updated url=https://github.com/lrstanley/links/releases/tag/v0.5.2
• uploading to release file=dist/links_0.5.2_checksums.txt name=links_0.5.2_checksums.txt
• uploading to release file=dist/links_0.5.2_linux_amd64.tar.gz name=links_0.5.2_linux_amd64.tar.gz
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• uploading to release file=dist/links_0.5.2_windows_amd64.zip name=links_0.5.2_windows_amd64.zip
• failed to upload artifact, will retry artifact=links_0.5.2_windows_amd64.zip error=POST https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_windows_amd64.zip: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=1
• uploading to release file=dist/links_0.5.2_linux_amd64.deb name=links_0.5.2_linux_amd64.deb
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52738->140.82.113.13:443: write: broken pipe try=1
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.tar.gz": write tcp 10.1.0.4:52736->140.82.113.13:443: use of closed network connection try=1
• failed to upload artifact, will retry artifact=links_0.5.2_checksums.txt error=POST https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_checksums.txt: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=1
• uploading to release file=dist/links_0.5.2_linux_amd64.rpm name=links_0.5.2_linux_amd64.rpm
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• uploading to release file=dist/links_0.5.2_linux_amd64.tar.gz name=links_0.5.2_linux_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.deb error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.deb": write tcp 10.1.0.4:52740->140.82.113.13:443: use of closed network connection try=1
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.rpm error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.rpm": write tcp 10.1.0.4:52742->140.82.113.13:443: use of closed network connection try=1
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52744->140.82.113.13:443: write: broken pipe try=2
• uploading to release file=dist/links_0.5.2_linux_amd64.deb name=links_0.5.2_linux_amd64.deb
• uploading to release file=dist/links_0.5.2_linux_amd64.rpm name=links_0.5.2_linux_amd64.rpm
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.tar.gz error=POST https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=2
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.rpm error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.rpm": http: server closed idle connection try=2
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• uploading to release file=dist/links_0.5.2_linux_amd64.rpm name=links_0.5.2_linux_amd64.rpm
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.deb error=POST https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.deb: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=2
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52750->140.82.113.13:443: use of closed network connection try=3
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.rpm error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.rpm": EOF try=3
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• uploading to release file=dist/links_0.5.2_linux_amd64.rpm name=links_0.5.2_linux_amd64.rpm
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52754->140.82.113.13:443: use of closed network connection try=4
• failed to upload artifact, will retry artifact=links_0.5.2_linux_amd64.rpm error=POST https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_linux_amd64.rpm: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=4
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52758->140.82.113.13:443: use of closed network connection try=5
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": EOF try=6
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52770->140.82.113.13:443: write: broken pipe try=7
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52772->140.82.113.13:443: use of closed network connection try=8
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52774->140.82.113.13:443: use of closed network connection try=9
• uploading to release file=dist/links_0.5.2_freebsd_amd64.tar.gz name=links_0.5.2_freebsd_amd64.tar.gz
• failed to upload artifact, will retry artifact=links_0.5.2_freebsd_amd64.tar.gz error=Post "https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_freebsd_amd64.tar.gz": write tcp 10.1.0.4:52786->140.82.113.13:443: use of closed network connection try=10
⨯ release failed after 63.39s error=github/gitlab/gitea releases: failed to publish artifacts: failed to upload links_0.5.2_windows_amd64.zip after 1 tries: POST https://uploads.github.com/repos/lrstanley/links/releases/31633537/assets?name=links_0.5.2_windows_amd64.zip: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}]
Error: The process '/opt/hostedtoolcache/goreleaser-action/0.147.0/x64/goreleaser' failed with exit code 1