Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release-publishing workflow using GoReleaser #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aidansteele
Copy link

Here's a PR that will use GoReleaser for publishing new releases. A few things to note:

  1. You should create a GitHub personal access token to allow GoReleaser to update your Homebrew tap repo. The token generated by GitHub Actions won't suffice for cross-repo access. I recommend creating a fine-grained access token that has Read and write access to Contents for just that specific repo. You should then save it as GORELEASER_HOMEBREW_TAP_TOKEN in the Actions secrets for this repo.
  2. The workflow to create releases is to create a Git tag. That will trigger the workflow to run GoReleaser, which will populate the "release" info in GitHub.
  3. I changed the Version var to version. This variable will be populated at compile-time by GoReleaser with the name of the tag. Cmd+F ldflags on this page for more info.

@aidansteele
Copy link
Author

Personally, the way I create new tags is:

  • Click Draft a new release on the releases page.

CleanShot 2023-04-18 at 16 00 19@2x

  • Click Choose a tag, type in the new tag name and click create new tag on publish

CleanShot 2023-04-18 at 16 01 48@2x

  • Leave everything else untouched and click Publish release. This will trigger the GoReleaser workflow. GoReleaser will populate the release notes and attach the new binaries to this release.

CleanShot 2023-04-18 at 16 02 50@2x

@@ -31,7 +31,7 @@ import (
"github.com/aws/smithy-go"
)

var Version string = "2.6"
var version string = "(unknown)" // this is set by goreleaser
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not export the version, if this is used as a module in a bigger program?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this also loses go install'd versioning. I've recently been using https://github.com/carlmjohnson/versioninfo/ which works for both goreleaser and go install, and should also work when imported as a library

homepage: https://github.com/benkehoe/aws-whoami-golang
maintainer: Ben Kehoe
description: A tool to show what AWS account and identity you're using.
formats: [ deb ]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you ever tried to make an RPM easily available for installation on Amazon Linux? I'm not clear if that would have to involve getting it in a particular yum repo or what

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants