bitnami / wait-for-port

CLI tool for waiting until a TCP port reaches the desired state
https://bitnami.com
Apache License 2.0
39 stars 11 forks source link

Use GoReleaser to build binaries #16

Open bodgit opened 1 year ago

bodgit commented 1 year ago

Description of the change

This PR changes the build process to instead use GoReleaser to build the release binaries.

Benefits

I use this action to automatically install tools from GitHub releases into my GitHub Actions workflows. It works mostly ok with your existing releases, downloading the latest release that matches the OS and architecture my workflow is running on, however because the binary within the release archive still has the OS and architecture as part of the filename, I have to make sure my workflow runs wait-for-port-$(uname -s)-$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') to ensure portability instead of just wait-for-port.

While I was trying to work out the cleanest way to change the binary filenames, I figured it would be just easier to use GoReleaser instead which is a popular tool for building Golang-based releases. This removes a lot of the boilerplate from your existing workflow. It also creates the releases for you with the changelog entries, etc. so you just need to push the new version tag.

Supporting more OS/architecture combinations is also easy to change by just updating the .goreleaser.yml configuration file.

Possible drawbacks

Anyone expecting the previous behaviour of the binary having the OS and architecture as part of the binary filename.

Applicable issues

Additional information

I've tuned the GoReleaser configuration so it creates release tarballs and checksums with the same filenames as previous releases.

I've disabled Cgo which means static stripped binaries are built as standard. Contrary to the comments in #9 the size of the binaries is almost exactly the same as the dynamically-linked versions, about 2 MiB so this means things will work on Alpine.

I've also updated the some of the actions to their latest versions, I'd recommend maybe enabling Dependabot to keep these updated.