Skip to content

Commit

Permalink
Setup goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravkghildiyal committed Nov 1, 2024
1 parent bd38021 commit 8de3445
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/
vendor/
.vscode/
dist/
50 changes: 50 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://goreleaser.com/
#
# For local testing, use:
#
# goreleaser release --snapshot --clean
project_name: gwctl

before:
hooks:
# Ensure the project builds successfully before release.
- make build

# Refer https://goreleaser.com/customization/builds/ for all available options.
builds:
- id: gwctl # Build ID for reference.
main: ./main.go
binary: gwctl # Binary name.
env:
- CGO_ENABLED=0 # Disable CGO for broader compatibility.
goos:
- linux
- darwin
- windows
goarch:
- 386
- amd64
- arm64
ldflags:
# Reduce the size of the binary. Ref: https://pkg.go.dev/cmd/link
- -s -w
# Embed versioning and build information in the binary.
- -X sigs.k8s.io/gwctl/pkg/version.version={{.Version}}
- -X sigs.k8s.io/gwctl/pkg/version.gitCommit={{.FullCommit}}
- -X sigs.k8s.io/gwctl/pkg/version.buildDate={{.Date}}

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

0 comments on commit 8de3445

Please sign in to comment.