-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: created | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write # for publishing to github releases | ||
|
||
jobs: | ||
releases-matrix: | ||
name: Release Go Binary | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# build and publish in parallel: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64 | ||
goos: [linux, windows, darwin] | ||
goarch: [amd64, arm64] | ||
exclude: | ||
- goarch: arm64 | ||
goos: windows | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: wangyoucao577/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
extra_files: LICENSE README.md | ||
compress_assets: "true" | ||
md5sum: "false" | ||
project_path: aws-whoami | ||
binary_name: aws-whoami | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- run: git fetch --force --tags | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
|
||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GORELEASER_HOMEBREW_TAP_TOKEN: ${{ secrets.GORELEASER_HOMEBREW_TAP_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
dist/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
project_name: aws-whoami | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- arm64 | ||
- amd64 | ||
main: ./aws-whoami | ||
nfpms: | ||
- package_name: aws-whoami | ||
vendor: Ben Kehoe | ||
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 ] | ||
brews: | ||
- name: aws-whoami | ||
tap: | ||
owner: benkehoe | ||
name: homebrew-tap | ||
token: '{{ .Env.GORELEASER_HOMEBREW_TAP_TOKEN }}' | ||
commit_author: | ||
name: Ben Kehoe | ||
email: [email protected] | ||
homepage: https://github.com/benkehoe/aws-whoami-golang | ||
description: A tool to show what AWS account and identity you're using. | ||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of uname. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
# The lines beneath this are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ import ( | |
"github.com/aws/smithy-go" | ||
) | ||
|
||
var Version string = "2.6" | ||
var version string = "(unknown)" // this is set by goreleaser | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing this also loses |
||
var DisableAccountAliasEnvVarName = "AWS_WHOAMI_DISABLE_ACCOUNT_ALIAS" | ||
|
||
type Whoami struct { | ||
|
@@ -275,7 +275,7 @@ func main() { | |
flag.Parse() | ||
|
||
if *showVersion { | ||
fmt.Println(Version) | ||
fmt.Println(version) | ||
return | ||
} | ||
|
||
|
There was a problem hiding this comment.
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