Repair the release workflow#12
Merged
Merged
Conversation
The v4.3.0 tag never produced a release: the run failed on "Set up Go 1.21" and the release and homebrew jobs never started. The workflow was pinned to actions/setup-go@v1, actions/checkout@v1 and the archived actions/create-release, all of which run on Node runtimes GitHub has retired, and it asked for Go 1.21 while go.mod now requires 1.24. Move to current actions, take the Go version from go.mod so the two cannot drift again, and publish with the gh CLI instead of the archived release actions. Correct the ldflags path while here. It set -X valar/cli/cmd.version, but the module is github.com/valar/cli, and the linker silently ignores -X for a symbol that does not exist. Every released binary therefore had an empty version string, which left cobra without a --version flag at all. A new step asserts the built binary reports the tag before publishing. Fix two latent bugs in the homebrew job that would have fired the first time it ran: it redirected awk into the same file it was reading, which truncates the formula before awk opens it, and it embedded the trailing " -" of sha256sum output into the formula. Also run build, vet and test on pushes and pull requests. The repository has tests now and nothing was running them.
checkout@v4 and setup-go@v5 target Node 20, which GitHub has deprecated and is already force-running on Node 24. Node 20 reaching end of life on the runners is the same bit-rot that broke this workflow before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
v4.3.0was tagged and pushed five months ago but never produced a release — the last published release is v4.2.1. The run failed on its very first step,Set up Go 1.21, so the release and homebrew jobs never started.The workflow was pinned to
actions/setup-go@v1,actions/checkout@v1and the archivedactions/create-release/actions/upload-release-asset, all of which run on Node runtimes GitHub has retired. It also asked for Go 1.21 whilego.modnow requires 1.24.What changed
checkout@v4,setup-go@v5), with the Go version read fromgo.modso the two cannot drift apart again.gh release createrather than the archived release actions — no third-party action needed.build,vetandteston pushes and pull requests. The repository has tests now and nothing was running them.The version was never being stamped
The workflow set
-X valar/cli/cmd.version, but the module isgithub.com/valar/cli. The linker silently ignores-Xfor a symbol that does not exist, so the variable stayed empty in every published binary — and becauserootCmd.Versionwas empty, cobra never registered a--versionflag at all. Verified locally against this branch:A
Verify the version was stampedstep now asserts the built binary reports the tag before anything is published, so this cannot regress silently.Homebrew job
Two latent bugs that would have fired the first time it actually ran:
awk ... Formula/valar.rb > Formula/valar.rb— the shell truncates the file before awk opens it, destroying the formula. Now written via a temporary file.sha256sum -emits<hash> -, and the trailing-was being substituted into the formula. Now takes the first field.Also replaces the deprecated
::set-output, and skips the commit when the formula is already current instead of failing on an empty commit.