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 goreleaser github action #174

Merged
merged 3 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: goreleaser

on:
push:
tags:
- '!v0.3*'
jobs:
goreleaser:
environment: arlon
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
Rohitrajak1807 marked this conversation as resolved.
Show resolved Hide resolved
-
name: Cache go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Test controllers
uses: phalanks/[email protected]
with:
version: '0.20.2'
args: './controllers/...'
-
name: Run package tests
run: |
make pkgtest
-
name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
52 changes: 52 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
- make fmt
- make vet
builds:
- id: 'cli'
env:
- CGO_ENABLED=0
goos:
- linux
# - windows # coming soon?
- darwin
goarch:
- 'amd64'
- '386'
- 'arm64'
ignore:
- goos: 'darwin'
goarch: '386'
- goos: 'linux'
goarch: 'arm'
goarm: '7'
- goarm: 'mips64'
- gomips: 'hardfloat'
- goamd64: 'v4'
skip: false
no_unique_dist_dir: true
mod_timestamp: '{{ .CommitTimestamp }}'
binary: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}_v{{ .Version }}'

archives:
- id: 'cli'
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}_{{ .Version }}'
replacements:
darwin: 'Darwin'
linux: 'Linux'
windows: 'Windows'
386: 'i386'
amd64: 'x86_64'
checksum:
name_template: 'checksums.txt'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- 'refactor'
- 'minor fix'
- 'cleanup'
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef

pkgtest:
go test -v ./pkg/...