Skip to content

Commit 84a6a4c

Browse files
committed
Add Goreleaser to build releases
1 parent 8957068 commit 84a6a4c

7 files changed

+281
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
/gotools/golangci-lint
1616
/gotools/go-winres
1717
test/venv
18+
/dist

.goreleaser.yaml

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# Make sure to check the documentation at https://goreleaser.com
2+
release:
3+
draft: true
4+
replace_existing_draft: true
5+
6+
before:
7+
hooks:
8+
# You may remove this if you don't use go modules.
9+
- go mod tidy
10+
# you may remove this if you don't need go generate
11+
- go generate ./...
12+
builds:
13+
- id: linux
14+
main: ./cmd/tkey-ssh-agent
15+
binary: tkey-ssh-agent
16+
env:
17+
- GOPROXY=https://proxy.golang.org,direct
18+
- GOSUMDB=sum.golang.org
19+
- CGO_ENABLED=0
20+
21+
goos:
22+
- linux
23+
goarch:
24+
- amd64
25+
- arm64
26+
flags:
27+
- -trimpath
28+
29+
# Custom ldflags mostly to avoid setting main.date which for some
30+
# reason is default
31+
ldflags:
32+
-w -X main.version={{ .Version }} -X main.signerAppNoTouch= -buildid=
33+
34+
- id: darwin
35+
main: ./cmd/tkey-ssh-agent
36+
binary: tkey-ssh-agent
37+
env:
38+
- GOPROXY=https://proxy.golang.org,direct
39+
- GOSUMDB=sum.golang.org
40+
- CGO_ENABLED=1
41+
42+
goos:
43+
- darwin
44+
goarch:
45+
- amd64
46+
- arm64
47+
flags:
48+
- -trimpath
49+
50+
# Custom ldflags mostly to avoid setting main.date which for some
51+
# reason is default
52+
ldflags:
53+
-w -X main.version={{ .Version }} -X main.signerAppNoTouch= -buildid=
54+
55+
- id: windows
56+
main: ./cmd/tkey-ssh-agent
57+
binary: tkey-ssh-agent
58+
env:
59+
- GOPROXY=https://proxy.golang.org,direct
60+
- GOSUMDB=sum.golang.org
61+
- CGO_ENABLED=0
62+
63+
goos:
64+
- windows
65+
goarch:
66+
- amd64
67+
- arm64
68+
flags:
69+
- -trimpath
70+
71+
# Custom ldflags mostly to avoid setting main.date which for some
72+
# reason is default
73+
ldflags:
74+
-w -X main.version={{ .Version }} -X main.signerAppNoTouch= -buildid=
75+
76+
hooks:
77+
pre: cd ./cmd/tkey-ssh-agent && go-winres make --arch amd64
78+
79+
- id: windows-tray
80+
main: ./cmd/tkey-ssh-agent-tray
81+
binary: tkey-ssh-agent-tray
82+
env:
83+
- GOPROXY=https://proxy.golang.org,direct
84+
- GOSUMDB=sum.golang.org
85+
- CGO_ENABLED=0
86+
87+
goos:
88+
- windows
89+
goarch:
90+
- amd64
91+
- arm64
92+
flags:
93+
- -trimpath
94+
95+
# Custom ldflags mostly to avoid setting main.date which for some
96+
# reason is default
97+
ldflags:
98+
-w -H windowsgui -buildid=
99+
100+
hooks:
101+
pre: cd ./cmd/tkey-ssh-agent-tray && go-winres make --arch amd64
102+
103+
universal_binaries:
104+
- ids:
105+
- darwin
106+
replace: true
107+
name_template: "tkey-ssh-agent"
108+
hooks:
109+
post: gon gon.hcl
110+
111+
archives:
112+
- format: tar.gz
113+
allow_different_binary_count: true
114+
# this name template makes the OS and Arch compatible with the results of uname.
115+
name_template: >-
116+
{{ "tkey-ssh-agent" }}_
117+
{{- .Version }}_
118+
{{- title .Os }}_
119+
{{- if eq .Arch "all" }}universal
120+
{{- else }}{{ .Arch }}{{ end }}
121+
{{- if .Arm }}v{{ .Arm }}{{ end }}
122+
# use zip for windows archives
123+
format_overrides:
124+
- goos: windows
125+
format: zip
126+
files:
127+
- src: system/tkey-ssh-agent.1
128+
dst: man
129+
strip_parent: true
130+
131+
nfpms:
132+
# note that this is an array of nfpm configs
133+
- #
134+
# ID of the nfpm config, must be unique.
135+
136+
# Name of the package.
137+
package_name: tkey-ssh-agent
138+
139+
# Your app's vendor.
140+
vendor: Tillitis AB
141+
142+
# Your app's homepage.
143+
homepage: https://tillitis.se/
144+
145+
# Your app's maintainer (probably you).
146+
maintainer: Tillitis <hello@tillitis.se>
147+
148+
# Your app's description.
149+
description: |-
150+
SSH agent backed by Tillitis TKey
151+
tkey-ssh-agent is an alternative SSH agent backed by a private ed25519 key
152+
residing in the hardware TKey, a USB stick.
153+
154+
# Your app's license.
155+
license: GPL 2.0
156+
157+
# Formats to be generated.
158+
formats:
159+
- apk
160+
- deb
161+
- rpm
162+
- archlinux # Since: v1.13
163+
164+
dependencies:
165+
- pinentry-gnome3 | pinentry
166+
167+
bindir: /usr/bin
168+
169+
release: 1
170+
171+
section: misc
172+
173+
# Contents to add to the package.
174+
# GoReleaser will automatically add the binaries.
175+
contents:
176+
- src: system/tkey-ssh-agent.1
177+
dst: /usr/share/man/man1/tkey-ssh-agent.1
178+
file_info:
179+
mode: 0644
180+
181+
- src: system/tkey-ssh-agent.service
182+
dst: /usr/lib/systemd/user/tkey-ssh-agent.service
183+
file_info:
184+
mode: 0644
185+
186+
- src: system/60-tkey.rules
187+
dst: /usr/lib/udev/rules.d/60-tkey.rules
188+
file_info:
189+
mode: 0644
190+
191+
- src: system/copyright
192+
dst: /usr/share/docs/tkey-ssh-agent/
193+
file_info:
194+
mode: 0644
195+
196+
197+
# Scripts to execute during the installation of the package. (overridable)
198+
scripts:
199+
postinstall: "system/postinst"
200+
201+
# Custom configuration applied only to the Deb packager.
202+
deb:
203+
# Lintian overrides
204+
lintian_overrides:
205+
- statically-linked-binary
206+
- changelog-file-missing-in-native-package
207+
208+
209+
checksum:
210+
name_template: 'checksums.txt'
211+
snapshot:
212+
name_template: "{{ incpatch .Version }}-next"
213+
changelog:
214+
sort:
215+
filters:
216+
exclude:
217+
- '^docs:'
218+
- '^test:'
219+

gon.hcl

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
source = ["dist/tkey-ssh-agent_darwin_all/tkey-ssh-agent"]
3+
bundle_id = "com.tillitis.tkey-ssh-agent"
4+
5+
apple_id {
6+
username = "[email protected]"
7+
password = "@keychain:[email protected]"
8+
provider = "34722S433A"
9+
}
10+
11+
sign {
12+
application_identity = "Developer ID Application: Tillitis AB"
13+
}

system/copyright

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
3+
Files: *
4+
Copyright: 2024 Tillitis AB
5+
License: GPL-2

system/postinst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
case "$1" in
6+
configure)
7+
if udevadm --version >/dev/null; then
8+
udevadm control --reload || true
9+
udevadm trigger --action=add --subsystem-match=tty || true
10+
fi
11+
;;
12+
esac

system/tkey-ssh-agent.service

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[Unit]
2+
Description=An SSH agent backed by Tillitis TKey
3+
Documentation=https://github.com/tillitis/tkey-ssh-agent
4+
5+
[Service]
6+
ExecStart=/usr/bin/tkey-ssh-agent --uss --agent-path /%t/tkey-ssh-agent/sock
7+
ExecReload=/usr/bin/kill -HUP $MAINPID
8+
NoNewPrivileges=yes
9+
KeyringMode=private
10+
UMask=0177
11+
ProtectSystem=strict
12+
RuntimeDirectory=tkey-ssh-agent
13+
RuntimeDirectoryMode=0700
14+
ReadWritePaths=/dev /run
15+
RestrictAddressFamilies=AF_UNIX
16+
RestrictNamespaces=yes
17+
RestrictRealtime=yes
18+
RestrictSUIDSGID=yes
19+
LockPersonality=yes
20+
SystemCallFilter=@system-service
21+
SystemCallFilter=~@privileged @resources
22+
SystemCallErrorNumber=EPERM
23+
SystemCallArchitectures=native
24+
25+
[Install]
26+
WantedBy=default.target

tools/spdx-ensure

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ missingok_files=(
2323
.editorconfig
2424
.gitignore
2525
.golangci.yml
26+
.goreleaser.yaml
2627
LICENSE
2728
Makefile
2829
README.md
@@ -33,11 +34,15 @@ cmd/tkey-ssh-agent-tray/trayicon.ico
3334
dco.md
3435
go.mod
3536
go.sum
37+
gon.hcl
3638
gotools/Makefile
3739
gotools/go.mod
3840
gotools/go.sum
3941
system/60-tkey.rules
42+
system/copyright
43+
system/postinst
4044
system/tkey-ssh-agent.1
45+
system/tkey-ssh-agent.service
4146
system/tkey-ssh-agent.service.tmpl
4247
test/attic/test-loop.sh
4348
test/requirements.txt

0 commit comments

Comments
 (0)