1# GoReleaser configuration for PR preview builds.
2# Triggered by /build command on PRs.
3# Uses --snapshot mode (no semver tag required).
4version: 2
5
6before:
7 hooks:
8 - go mod tidy
9
10builds:
11 - id: matcha
12 main: .
13 goos:
14 - linux
15 - darwin
16 - windows
17 goarch:
18 - amd64
19 - arm64
20 flags:
21 - -trimpath
22 ldflags:
23 - -s -w -buildid= -X main.version=preview-{{.ShortCommit}} -X main.commit={{.Commit}} -X main.date={{.Date}}
24 env:
25 - CGO_ENABLED=1
26 - >-
27 {{- if eq .Os "darwin" }}SDKROOT={{ .Env.SDK_PATH }}{{- end }}
28 - >-
29 {{- if eq .Os "darwin" }}MACOSX_DEPLOYMENT_TARGET=11.0{{- end }}
30 - >-
31 {{- if eq .Os "darwin" }}CGO_CFLAGS=-isysroot {{ .Env.SDK_PATH }} -mmacosx-version-min=11.0{{- end }}
32 - >-
33 {{- if eq .Os "darwin" }}CGO_LDFLAGS=-isysroot {{ .Env.SDK_PATH }}
34 {{- else if eq .Os "linux" }}CGO_LDFLAGS=-L{{ .Env.PCSC_DIR }}/lib/{{ .Arch }}
35 {{- end }}
36 - >-
37 {{- if eq .Os "darwin" }}
38 {{- if eq .Arch "amd64"}}CC=clang -arch x86_64 -isysroot {{ .Env.SDK_PATH }}{{- end }}
39 {{- if eq .Arch "arm64"}}CC=clang -arch arm64 -isysroot {{ .Env.SDK_PATH }}{{- end }}
40 {{- else if eq .Os "linux" }}
41 {{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-linux-musl -lc{{- end }}
42 {{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-linux-musl -lc{{- end }}
43 {{- else if eq .Os "windows" }}
44 {{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-windows-gnu -lc{{- end }}
45 {{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-windows-gnu -lc{{- end }}
46 {{- end }}
47
48archives:
49 - formats: [tar.gz]
50 name_template: "{{ .ProjectName }}_preview_{{ .Os }}_{{ .Arch }}"
51 format_overrides:
52 - goos: windows
53 formats: ["zip"]
54 files:
55 - LICENSE
56 - README.md
57
58checksum:
59 name_template: "checksums.txt"
60
61snapshot:
62 version_template: "preview-{{ .ShortCommit }}"