-
Notifications
You must be signed in to change notification settings - Fork 1
/
.goreleaser.yaml
472 lines (438 loc) · 11.6 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# SPDX-FileCopyrightText: Josef Andersson
#
# SPDX-License-Identifier: CC0-1.0
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
---
version: 2
project_name: gitprovidersync
# https://goreleaser.com/customization/env
env:
- CGO_ENABLED=0
- LDFLAGS=-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
before:
hooks:
- go mod tidy
- go install github.com/vektra/mockery/v2@v2.46.0
- ./scripts/generatemock.sh
- ./scripts/manpage.sh
- ./scripts/completions.sh
# https://goreleaser.com/customization/builds/
builds:
## linux -------------------
- id: "linux-amd64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- linux
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "linux-arm64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- linux
goarch:
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "linux-ppc64le"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- linux
goarch:
- ppc64le
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "linux-riscv64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- linux
goarch:
- riscv64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
## darwin -------------------
- id: "darwin-amd64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- darwin
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "darwin-arm64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- darwin
goarch:
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
## freebsd -------------------
- id: "freebsd-amd64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- freebsd
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "freebsd-arm"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- freebsd
goarch:
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "freebsd-risc"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- freebsd
goarch:
- riscv64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
## dragonfly -------------------
- id: "dragonfly-amd64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- dragonfly
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
## netbsd -------------------
- id: "netbsd-amd64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- netbsd
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "netbsd-arm64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- netbsd
goarch:
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
## openbsd -------------------
- id: "openbsd-amd64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- openbsd
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "openbsd-arm64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- openbsd
goarch:
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
- id: "openbsd-riscv64"
binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
main: ./main.go
no_unique_dist_dir: true
goos:
- openbsd
goarch:
- riscv64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "{{ .Env.LDFLAGS }}"
## plan9 ------------------- disabled, flaky https://github.com/golang/go/issues/49338
# - id: "plan9-amd64"
# binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
# main: ./main.go
# no_unique_dist_dir: true
# goos:
# - plan9
# goarch:
# - amd64
# mod_timestamp: "{{ .CommitTimestamp }}"
# flags:
# - -trimpath
# ldflags:
# - "{{ .Env.LDFLAGS }}"
# - id: "plan9-arm"
# binary: gitprovidersync-{{ .Os }}-{{ .Arch }}
# main: ./main.go
# no_unique_dist_dir: true
# goos:
# - plan9
# goarch:
# - arm
# mod_timestamp: "{{ .CommitTimestamp }}"
# flags:
# - -trimpath
# ldflags:
# - "{{ .Env.LDFLAGS }}"
#
# verifiable builds TO-DO enable when repo public
# https://goreleaser.com/customization/verifiable_builds/
# gomod:
# proxy: true
# source archive
source:
enabled: true
name_template: "{{ .ProjectName }}-{{ .Version }}-src"
# https://goreleaser.com/customization/archive/
# tar.gz archives - binary, license info, docs
archives:
- id: archive
format: tar.gz
wrap_in_directory: true
allow_different_binary_count: true
files:
- LICENSE
- README.adoc
- REUSE.toml
- LICENSES
- SECURITY.md
- docs/*
- generated/manpages/*
- generated/completions/*
# https://goreleaser.com/customization/nfpm/
# to-do: sign deb rpm
# deb, rpm, apk, rpm
nfpms:
- file_name_template: "{{ .ConventionalFileName }}"
maintainer: Josef Andersson <janderssonse@proton.me>
vendor: Itiquette
homepage: https://github.com/itiquette/git-provider-sync
description: A tool for syncing Git providers.
license: EUPL-1.2
section: utils
bindir: /usr/bin
contents:
- src: ./generated/completions/gitprovidersync.bash
dst: /usr/share/bash-completion/completions/gitprovidersync
file_info:
mode: 0644
- src: ./generated/completions/gitprovidersync.fish
dst: /usr/share/fish/vendor_completions.d/gitprovidersync
file_info:
mode: 0644
- src: ./generated/completions/gitprovidersync.zsh
dst: /usr/share/zsh/vendor-completions/_gitprovidersync
file_info:
mode: 0644
- src: ./generated/manpages/gitprovidersync.1.gz
dst: /usr/share/man/man1/
file_info:
mode: 0644
- src: ./LICENSE
dst: /usr/share/doc/gitprovidersync/copyright
file_info:
mode: 0644
dependencies:
- git
formats:
- deb
- rpm
- apk
deb:
lintian_overrides:
- statically-linked-binary
# https://goreleaser.com/customization/snapcraft/
# to-do: consider snap
# https://goreleaser.com/customization/docker/#customization
# to-do: copy extra files - license, doc etc
# to-do: consider use ko instead https://goreleaser.com/customization/ko/
# container image , multi arch
dockers:
- image_templates:
- "ghcr.io/itiquette/{{.ProjectName}}:v{{ .Version }}-amd64"
dockerfile: Containerfile
use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- --pull
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.source={{ .GitURL}}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ .Date }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=EUPL-1.2
- image_templates:
- "ghcr.io/itiquette/{{.ProjectName}}:v{{ .Version }}-arm64"
dockerfile: Containerfile
use: buildx
goos: linux
goarch: arm64
build_flag_templates:
- --pull
- --platform=linux/arm64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.source={{ .GitURL}}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ .Date }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=EUPL-1.2
# https://goreleaser.com/customization/docker_manifest/
docker_manifests:
- name_template: "ghcr.io/itiquette/{{.ProjectName}}:v{{ .Version }}"
image_templates:
- "ghcr.io/itiquette/{{.ProjectName}}:v{{ .Version }}-amd64"
- "ghcr.io/itiquette/{{.ProjectName}}:v{{ .Version }}-arm64"
# https://goreleaser.com/customization/checksum/
# artifacts checksum
checksum:
name_template: "{{ .ProjectName }}_checksums_sha256.txt"
algorithm: sha256
# https://goreleaser.com/customization/metadata/
# metadata
metadata:
mod_timestamp: "{{ .CommitTimestamp }}"
# https://goreleaser.com/customization/sbom/
# sboms - output sbom for archive, source and linux-packages (with syft)
sboms:
- id: archive
artifacts: archive
- id: source
artifacts: source
- id: package
artifacts: package
# https://goreleaser.com/customization/reportsizes/
report_sizes: true
# sign (checksum file)
# https://goreleaser.com/customization/sign
signs:
- cmd: cosign
certificate: "${artifact}.pem"
args:
- sign-blob
- "--output-certificate=${certificate}"
- "--output-signature=${signature}"
- "${artifact}"
- "--yes" # needed on cosign 2.0.0+
artifacts: checksum
output: true
# sign (container image)
# https://goreleaser.com/customization/docker_sign
docker_signs:
- cmd: cosign
artifacts: all
output: true
args:
- "sign"
- "${artifact}@${digest}"
- "--yes" # needed on cosign 2.0.0+
# changelog
changelog:
sort: asc
use: github
filters:
exclude:
- "^test:"
- "^test\\("
- "merge conflict"
- Merge pull request
- Merge remote-tracking branch
- Merge branch
- go mod tidy
groups:
- title: Dependency updates
regexp: '^.*?(.+)\(deps\)!?:.+$'
order: 300
- title: "New Features"
regexp: '^.*?feat(\(.+\))??!?:.+$'
order: 100
- title: "Bug fixes"
regexp: '^.*?(fix|refactor)(\(.+\))??!?:.+$'
order: 200
- title: "Documentation updates"
regexp: ^.*?docs?(\(.+\))??!?:.+$
order: 400
- title: "Build process updates"
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
order: 400
- title: Other work
order: 9999
release:
name_template: "v{{ .Version }}"
footer: |
**Full Changelog**: https://github.com/itiquette/git-provider-sync/compare/{{ .PreviousTag }}...{{ if .IsNightly }}nightly{{ else }}{{ .Tag }}{{ end }}