Skip to content

Commit

Permalink
build: use project name field
Browse files Browse the repository at this point in the history
and packaging the docker thru goreleaser

Signed-off-by: Dwi Siswanto <[email protected]>
  • Loading branch information
dwisiswant0 committed Mar 22, 2024
1 parent a9bb18c commit 39a1b52
Showing 1 changed file with 48 additions and 35 deletions.
83 changes: 48 additions & 35 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env:
- CGO_ENABLED=1
- PGO_FILE=default.pgo

before:
hooks:
Expand All @@ -9,9 +10,9 @@ release:
prerelease: auto

builds:
- id: teler-proxy_darwin-amd64
binary: teler-proxy
main: ./cmd/teler-proxy
- id: "{{ .ProjectName }}_darwin-amd64"
binary: "{{ .ProjectName }}"
main: ./cmd/{{ .ProjectName }}
goarch:
- amd64
goos:
Expand All @@ -21,13 +22,13 @@ builds:
- CXX=o64-clang++
flags:
- -trimpath
- -pgo=default.pgo
- -pgo={{ .Env.PGO_FILE }}
ldflags:
- -s -w -X github.com/kitabisa/teler-proxy/common.Version={{ .Version }}
- -s -w -X github.com/kitabisa/{{ .ProjectName }}/common.Version={{ .Version }}

- id: teler-proxy_darwin-arm64
binary: teler-proxy
main: ./cmd/teler-proxy
- id: "{{ .ProjectName }}_darwin-arm64"
binary: "{{ .ProjectName }}"
main: ./cmd/{{ .ProjectName }}
goarch:
- arm64
goos:
Expand All @@ -37,13 +38,13 @@ builds:
- CXX=oa64-clang++
flags:
- -trimpath
- -pgo=default.pgo
- -pgo={{ .Env.PGO_FILE }}
ldflags:
- -s -w -X github.com/kitabisa/teler-proxy/common.Version={{ .Version }}
- -s -w -X github.com/kitabisa/{{ .ProjectName }}/common.Version={{ .Version }}

- id: teler-proxy_linux-amd64
binary: teler-proxy
main: ./cmd/teler-proxy
- id: "{{ .ProjectName }}_linux-amd64"
binary: "{{ .ProjectName }}"
main: ./cmd/{{ .ProjectName }}
env:
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
Expand All @@ -53,13 +54,13 @@ builds:
- linux
flags:
- -trimpath
- -pgo=default.pgo
- -pgo={{ .Env.PGO_FILE }}
ldflags:
- -s -w -X github.com/kitabisa/teler-proxy/common.Version={{ .Version }}
- -s -w -X github.com/kitabisa/{{ .ProjectName }}/common.Version={{ .Version }}

- id: teler-proxy_linux-arm64
binary: teler-proxy
main: ./cmd/teler-proxy
- id: "{{ .ProjectName }}_linux-arm64"
binary: "{{ .ProjectName }}"
main: ./cmd/{{ .ProjectName }}
goarch:
- arm64
goos:
Expand All @@ -69,13 +70,13 @@ builds:
- CXX=aarch64-linux-gnu-g++
flags:
- -trimpath
- -pgo=default.pgo
- -pgo={{ .Env.PGO_FILE }}
ldflags:
- -s -w -X github.com/kitabisa/teler-proxy/common.Version={{ .Version }}
- -s -w -X github.com/kitabisa/{{ .ProjectName }}/common.Version={{ .Version }}

- id: teler-proxy_windows-amd64
binary: teler-proxy
main: ./cmd/teler-proxy
- id: "{{ .ProjectName }}_windows-amd64"
binary: "{{ .ProjectName }}"
main: ./cmd/{{ .ProjectName }}
goarch:
- amd64
goos:
Expand All @@ -85,27 +86,27 @@ builds:
- CXX=x86_64-w64-mingw32-g++
flags:
- -trimpath
- -pgo=default.pgo
- -pgo={{ .Env.PGO_FILE }}
- -buildmode=exe
ldflags:
- -s -w -X github.com/kitabisa/teler-proxy/common.Version={{ .Version }}
- -s -w -X github.com/kitabisa/{{ .ProjectName }}/common.Version={{ .Version }}

universal_binaries:
- id: teler-proxy_darwin-universal
- id: "{{ .ProjectName }}_darwin-universal"
ids:
- teler-proxy_darwin-amd64
- teler-proxy_darwin-arm64
- "{{ .ProjectName }}_darwin-amd64"
- "{{ .ProjectName }}_darwin-arm64"
replace: true
name_template: "teler-proxy"
name_template: "{{ .ProjectName }}"

archives:
- id: build
builds:
- teler-proxy_darwin-universal
- teler-proxy_linux-amd64
- teler-proxy_linux-arm64
- teler-proxy_windows-amd64
name_template: "teler-proxy_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
- "{{ .ProjectName }}_darwin-universal"
- "{{ .ProjectName }}_linux-amd64"
- "{{ .ProjectName }}_linux-arm64"
- "{{ .ProjectName }}_windows-amd64"
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
files:
- "LICENSE*"
Expand All @@ -119,4 +120,16 @@ checksum:
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
sort: asc

dockers:
- image_templates:
- "ghcr.io/kitabisa/{{ .ProjectName }}:{{ .Tag }}"
- "ghcr.io/kitabisa/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}"
- "ghcr.io/kitabisa/{{ .ProjectName }}:v{{ .Major }}"
- "ghcr.io/kitabisa/{{ .ProjectName }}:latest"
dockerfile: Dockerfile
use: docker
build_flag_templates:
- "--pull"
- "--build-arg=VERSION={{ .Tag }}"

0 comments on commit 39a1b52

Please sign in to comment.