-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.goreleaser.yaml
77 lines (76 loc) · 3.4 KB
/
.goreleaser.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This is a goreleaser file to build the linux binary.
# It was initially generated by goreleaser init
# You can build locally (even non-linux) by running:
# goreleaser build --snapshot --single-target
before:
hooks:
- pwd
env:
# define env vars so we can refer to them in {{ index .Env ... }} below
# For the names of the cross compilers in the goreleaser-cross image, see
# https://github.com/goreleaser/goreleaser-cross/tree/v1.20.4#supported-toolchainsplatforms
- CC_darwin_amd64=o64-clang
- CCX_darwin_amd64=o64-clang++
- CC_darwin_arm64=oa64-clang
- CCX_darwin_arm64=oa64-clang++
- CC_linux_amd64=x86_64-linux-gnu-gcc
- CCX_linux_amd64=x86_64-linux-gnu-g++
- CC_linux_arm64=aarch64-linux-gnu-gcc
- CCX_linux_arm64=aarch64-linux-gnu-g++
builds:
- binary: jobsworth
goos: [darwin, linux]
goarch: [amd64, arm64]
# -tags=static: use staticically linked git2go
# https://github.com/libgit2/git2go/tree/v34.0.0#main-branch-or-vendored-static-linking
# to debug, add -v, -x
flags: [-tags=static, -trimpath]
hooks:
pre:
# Fix for exec: "pkg-config": executable file not found in $PATH
# Since goreleaser-cross docker image does not contain pkg-config,
# we install a fake pkg-config and then add the CGO_CFLAGS and CGO_LDFLAGS manually below
- bash -c "echo '#!/bin/bash' > /usr/local/bin/pkg-config && chmod +x /usr/local/bin/pkg-config"
- make --debug libgit2
ldflags:
# By default, goreleaser adds -s -w to remove the symbols and debugging information
# https://github.com/goreleaser/goreleaser/blob/v1.9.2/www/docs/customization/build.md#builds
# but jobsworth is only 13MB so that is negligible for us so we take out those flags
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -X main.builtBy=goreleaser
env:
- CGO_ENABLED=1
# Based on documentation example using templates on environment variables:
# https://goreleaser.com/customization/builds/#complex-template-environment-variables
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CCX={{ index .Env (print "CCX_" .Os "_" .Arch) }}'
# this is used by Makefile so it is relative to jobsworth
- 'LIBGIT2_STATIC_BUILD_DIR=git2go/static-build-{{ .Os }}-{{ .Arch }}'
# Fix for exec: "pkg-config": executable file not found in $PATH
# Since goreleaser-cross docker image does not contain pkg-config,
# we install a fake pkg-config above and define CGO_CFLAGS and CGO_LDFLAGS
# to replicate the pkg-config call:
# https://github.com/libgit2/git2go/blob/v34.0.0/Build_bundled_static.go#L9
- CGO_CFLAGS_DISALLOW=pkg-config.*
- 'CGO_CFLAGS=-I{{ .Env.PWD }}/git2go/static-build-{{ .Os }}-{{ .Arch }}/install/include'
- 'CGO_LDFLAGS=-L{{ .Env.PWD }}/git2go/static-build-{{ .Os }}-{{ .Arch }}/install/lib -lgit2'
archives:
- format: zip
# Hack to exclude extra files such as readme
# that are included by default.
# Goreleaser ignores this field if it is the empty array,
# so we need an array containing a dummy glob
# https://github.com/goreleaser/goreleaser/blob/v1.9.2/internal/pipe/archive/archive.go#L60
files: [nonexistant.txt*]
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
universal_binaries:
- id: jobsworth-darwin-universal
replace: true
name_template: jobsworth