Skip to content

Commit

Permalink
Add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Sep 20, 2023
1 parent 7738b79 commit 0229213
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ insert_final_newline = false
max_line_length = 120
tab_width = 4

[*.yml]
[{*.yml,*.yaml}]
indent_size = 2

[{*.go,*.go2}]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ gateh8
config.json
*.pem
!example/*/config.json
/dist/
76 changes: 76 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
project_name: gateh8

builds:
- id: gateh8
main: ./cmd/main.go
binary: gateh8
goos:
- linux
- darwin
- windows
- freebsd
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- '-s -w -extldflags "-static"'
hooks:
pre:
- go mod download
post:
- echo "Build completed"

archives:
- id: windows
format: zip
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
builds:
- gateh8
files:
- license*
- readme*
- format: tar.gz
builds:
- gateh8
files:
- license*
- readme*

dockers:
- image_templates:
- 'yarlson/gateh8:{{ .Tag }}-amd64'
use: buildx
dockerfile: Dockerfile.goreleaser
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--builder=mybuilder"
goarch: amd64
- image_templates:
- 'yarlson/gateh8:{{ .Tag }}-arm64'
dockerfile: Dockerfile.goreleaser
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--builder=mybuilder"
goarch: arm64

docker_manifests:
- name_template: 'yarlson/gateh8:{{ .Tag }}'
image_templates:
- 'yarlson/gateh8:{{ .Tag }}-amd64'
- 'yarlson/gateh8:{{ .Tag }}-arm64'

checksum:
name_template: 'checksums.txt'
algorithm: sha256

snapshot:
name_template: "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}"

changelog:
skip: true
3 changes: 3 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/gateh8"]
COPY gateh8 /

0 comments on commit 0229213

Please sign in to comment.