Skip to content

Commit 04a8379

Browse files
committed
ci: update goreleaser config
Signed-off-by: Carlos Alexandro Becker <[email protected]>
1 parent b359291 commit 04a8379

File tree

4 files changed

+168
-25
lines changed

4 files changed

+168
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dist/
22
completions/
3+
manpages/
34
svu
45
!internal/svu

.goreleaser.yml

Lines changed: 160 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,45 @@
22

33
version: 2
44

5-
variables:
5+
project_name: svu
6+
7+
metadata:
68
description: Semantic Version Utility
79
homepage: "https://github.com/caarlos0/svu"
10+
license: MIT
11+
maintainers:
12+
- "Carlos Alexandro Becker <carlos at becker dot software>"
13+
14+
snapshot:
15+
version_template: "{{ incpatch .Version }}-next"
16+
17+
before:
18+
hooks:
19+
- go mod tidy
20+
- ./scripts/completions.sh
21+
- ./scripts/manpages.sh
22+
23+
gomod:
24+
proxy: true
25+
26+
builds:
27+
- env:
28+
- CGO_ENABLED=0
29+
goos:
30+
- linux
31+
- darwin
32+
- windows
33+
goarch:
34+
- amd64
35+
- arm64
36+
mod_timestamp: "{{ .CommitTimestamp }}"
37+
flags:
38+
- -trimpath
39+
ldflags:
40+
- -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser
841

9-
includes:
10-
- from_url:
11-
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/build.yml
12-
- from_url:
13-
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/package_with_completions_no_aur.yml
14-
- from_url:
15-
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/release.yml
16-
- from_url:
17-
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/docker.yml
18-
- from_url:
19-
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/cosign_checksum.yml
20-
- from_url:
21-
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/cosign_docker.yml
42+
universal_binaries:
43+
- replace: true
2244

2345
furies:
2446
- account: caarlos0
@@ -28,29 +50,143 @@ archives:
2850
- README.md
2951
- LICENSE.md
3052
- completions/*
53+
- manpages/*
3154
format_overrides:
3255
- goos: windows
3356
formats: [zip]
3457

58+
nix:
59+
- repository:
60+
owner: caarlos0
61+
name: nur
62+
extra_install: |-
63+
installShellCompletion ./completions/*
64+
installManPage ./manpages/{{.ProjectName}}.1.gz
65+
3566
aurs:
3667
- maintainers:
3768
- "Carlos Alexandro Becker <carlos at becker dot software>"
3869
- "Rafael Dominiquini <rafaeldominiquini at gmail dor com>"
39-
description: "{{ .Var.description }}"
40-
name: "svu-bin"
41-
homepage: "{{ .Var.homepage }}"
42-
license: MIT
70+
name: "{{ .ProjectName }}-bin"
4371
private_key: "{{ .Env.AUR_KEY }}"
44-
git_url: "ssh://[email protected]/svu-bin.git"
72+
git_url: "ssh://[email protected]/{{ .ProjectName }}-bin.git"
4573
package: |-
4674
# bin
47-
install -Dm755 "./svu" "${pkgdir}/usr/bin/svu"
75+
install -Dm755 "./{{ .ProjectName }}" "${pkgdir}/usr/bin/{{ .ProjectName }}"
4876
# license
49-
install -Dm644 "./LICENSE.md" "${pkgdir}/usr/share/licenses/svu/LICENSE"
77+
install -Dm644 "./LICENSE.md" "${pkgdir}/usr/share/licenses/{{ .ProjectName }}/LICENSE"
5078
# completions
5179
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
5280
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
5381
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
54-
install -Dm644 "./completions/svu.bash" "${pkgdir}/usr/share/bash-completion/completions/svu"
55-
install -Dm644 "./completions/svu.zsh" "${pkgdir}/usr/share/zsh/site-functions/_svu"
56-
install -Dm644 "./completions/svu.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/svu.fish"
82+
install -Dm644 "./completions/{{ .ProjectName }}.bash" "${pkgdir}/usr/share/bash-completion/completions/{{ .ProjectName }}"
83+
install -Dm644 "./completions/{{ .ProjectName }}.zsh" "${pkgdir}/usr/share/zsh/site-functions/_{{ .ProjectName }}"
84+
install -Dm644 "./completions/{{ .ProjectName }}.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/{{ .ProjectName }}.fish"
85+
# man pages
86+
install -Dm644 "./manpages/{{ .ProjectName }}.1.gz" "${pkgdir}/usr/share/man/man1/{{ .ProjectName }}.1.gz"
87+
88+
homebrew_casks:
89+
- repository:
90+
owner: caarlos0
91+
name: homebrew-tap
92+
url:
93+
verified: "github.com/caarlos0/{{ .ProjectName }}"
94+
manpages:
95+
- "manpages/{{ .ProjectName }}.1.gz"
96+
completions:
97+
bash: "completions/{{ .ProjectName }}.bash"
98+
zsh: "completions/{{ .ProjectName }}.zsh"
99+
fish: "completions/{{ .ProjectName }}.fish"
100+
101+
nfpms:
102+
- file_name_template: "{{ .ConventionalFileName }}"
103+
contents:
104+
- src: ./completions/{{ .ProjectName }}.bash
105+
dst: /etc/bash_completion.d/{{ .ProjectName }}
106+
- src: ./completions/{{ .ProjectName }}.fish
107+
dst: /usr/share/fish/completions/{{ .ProjectName }}.fish
108+
- src: ./completions/{{ .ProjectName }}.zsh
109+
dst: /usr/local/share/zsh/site-functions/_{{ .ProjectName }}
110+
- src: ./manpages/{{ .ProjectName }}.1.gz
111+
dst: /usr/share/man/man1/{{ .ProjectName }}.1.gz
112+
formats:
113+
- deb
114+
- rpm
115+
- apk
116+
117+
checksum:
118+
name_template: "checksums.txt"
119+
120+
signs:
121+
- cmd: cosign
122+
signature: "${artifact}.sigstore.json"
123+
artifacts: checksum
124+
args:
125+
- sign-blob
126+
- "--bundle=${signature}"
127+
- "${artifact}"
128+
- "--yes"
129+
130+
dockers_v2:
131+
- images:
132+
- "ghcr.io/caarlos0/{{ .ProjectName }}"
133+
- "caarlos0/{{ .ProjectName }}"
134+
tags:
135+
- "{{ .Version }}"
136+
- latest
137+
labels:
138+
"org.opencontainers.image.created": "{{.Date}}"
139+
"org.opencontainers.image.name": "{{.ProjectName}}"
140+
"org.opencontainers.image.revision": "{{.FullCommit}}"
141+
"org.opencontainers.image.version": "{{.Version}}"
142+
"org.opencontainers.image.source": "{{.GitURL}}"
143+
"org.opencontainers.image.description": "Semantic Version Utility"
144+
annotations:
145+
"org.opencontainers.image.description": "Semantic Version Utility"
146+
147+
docker_signs:
148+
- cmd: cosign
149+
artifacts: manifests
150+
args:
151+
- "sign"
152+
- "${artifact}"
153+
- "--yes"
154+
155+
changelog:
156+
sort: asc
157+
use: github
158+
filters:
159+
exclude:
160+
- "^test:"
161+
- "^chore"
162+
- "merge conflict"
163+
- Merge pull request
164+
- Merge remote-tracking branch
165+
- Merge branch
166+
- go mod tidy
167+
groups:
168+
- title: Dependency updates
169+
regexp: "^.*feat\\(deps\\)*:+.*$"
170+
order: 300
171+
- title: "New Features"
172+
regexp: "^.*feat[(\\w)]*:+.*$"
173+
order: 100
174+
- title: "Bug fixes"
175+
regexp: "^.*fix[(\\w)]*:+.*$"
176+
order: 200
177+
- title: "Documentation updates"
178+
regexp: "^.*docs[(\\w)]*:+.*$"
179+
order: 400
180+
- title: Other work
181+
order: 9999
182+
183+
release:
184+
footer: |
185+
**Full Changelog**: https://github.com/caarlos0/{{ .ProjectName }}/compare/{{ .PreviousTag }}...{{ .Tag }}
186+
187+
---
188+
189+
_Released with [GoReleaser Pro](https://goreleaser.com/pro)!_
190+
191+
announce:
192+
skip: "{{gt .Patch 0}}"

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM alpine
2+
ARG TARGETPLATFORM
23
RUN apk add -U git
3-
COPY svu*.apk /tmp/
4+
COPY $TARGETPLATFORM/*.apk /tmp/
45
RUN git config --global safe.directory '*'
56
RUN apk add --allow-untrusted /tmp/*.apk
67
ENTRYPOINT ["svu"]

scripts/manpages.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
set -e
3+
rm -rf manpages
4+
mkdir manpages
5+
go run . man | gzip -c -9 >manpages/svu.1.gz

0 commit comments

Comments
 (0)