Skip to content

Commit

Permalink
feat: add goreleaser & binary publishing (#33)
Browse files Browse the repository at this point in the history
* Add goreleaser

Signed-off-by: Eytan Avisror <[email protected]>

* fix dynamic versioning

Signed-off-by: Eytan Avisror <[email protected]>

* address comments

Signed-off-by: Eytan Avisror <[email protected]>
  • Loading branch information
Eytan Avisror authored Apr 8, 2022
1 parent dbb7be8 commit 83c327b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
uses: docker/metadata-action@v3
with:
images: ${{ github.repository_owner }}/aws-auth
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v2
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release aws-auth binaries

on:
release:
types: [created]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ^1.17

- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# TODO: Test using krew-release-bot later

# - name: Update new version in krew-index
# uses: rajatjindal/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
go-version: ^1.17

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/*
coverage.txt
coverage.html
coverage.html
dist/
30 changes: 30 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- id: aws-auth
main: ./
binary: aws-auth
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
- -s
- -w
- -X github.com/keikoproj/aws-auth/cmd/cli.gitCommit={{.Commit}}
- -X github.com/keikoproj/aws-auth/cmd/cli.buildDate={{.Date}}
- -X github.com/keikoproj/aws-auth/cmd/cli.pkgVersion={{.Version}}
archives:
- builds:
- aws-auth
name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: false
format: tar.gz
files:
- LICENSE
2 changes: 1 addition & 1 deletion cmd/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
//It should be set during build via -ldflags.
buildDate string
// version is the aws-auth package version
pkgVersion string = "0.3.2"
pkgVersion string = "dev"
)

// Info holds the information related to descheduler app version.
Expand Down

0 comments on commit 83c327b

Please sign in to comment.