-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.goreleaser.yaml
202 lines (183 loc) · 6.37 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
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
project_name: "starlink_exporter"
report_sizes: true
env:
- AUTHOR=Joshua Sing <[email protected]>
- GITHUB_USER=joshuasing
- DOCKER_HUB_USER=joshuasing
- DESCRIPTION=A simple Starlink exporter for Prometheus
- LICENSE=MIT
before:
hooks:
- "go mod tidy"
- "go mod download"
- "go mod verify"
builds:
- binary: "{{ .ProjectName }}"
main: "./cmd/{{ .ProjectName }}/"
env: [ "CGO_ENABLED=0", "GOGC=off" ]
ldflags: [ "-s -w" ]
flags: [ "-trimpath" ]
goos:
- "linux"
- "windows"
- "darwin"
goarch:
- "amd64"
- "arm"
- "arm64"
goarm: [ "7" ]
ignore:
- goos: "windows"
goarch: "arm"
archives:
- format: "tar.gz"
wrap_in_directory: true
name_template: >-
{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: "windows"
format: "zip"
files:
- "README*"
- "LICENSE*"
# Create sources archive.
source:
enabled: true
name_template: "{{ .ProjectName }}_v{{ .Version }}_sources"
format: "tar.gz"
# Create checksums file.
checksum:
name_template: "{{ .ProjectName }}_v{{ .Version }}_checksums.txt"
algorithm: "sha256"
# Create SBOMs for all archives and the source archive.
sboms:
- id: "archive"
artifacts: "archive"
- id: "source"
artifacts: "source"
# Sign the checksum file, which includes the checksums for all files (including SBOMs).
signs:
- cmd: "cosign"
certificate: "${artifact}.pem"
args:
- "sign-blob"
- "--output-certificate=${certificate}"
- "--output-signature=${signature}"
- "${artifact}"
- "--yes"
artifacts: "checksum"
output: true
# Create Docker images.
dockers:
# linux/amd64
- id: "{{ .ProjectName }}-amd64"
goos: "linux"
goarch: "amd64"
dockerfile: ".goreleaser.Dockerfile"
use: buildx
image_templates:
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--build-arg=VERSION={{ .Version }}"
- "--build-arg=VCS_REF={{ .FullCommit }}"
- "--build-arg=BUILD_DATE={{ .Date }}"
# linux/arm64/v8
- id: "{{ .ProjectName }}-arm64"
goos: "linux"
goarch: "arm64"
dockerfile: ".goreleaser.Dockerfile"
use: buildx
image_templates:
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--build-arg=VERSION={{ .Version }}"
- "--build-arg=VCS_REF={{ .FullCommit }}"
- "--build-arg=BUILD_DATE={{ .Date }}"
# linux/arm/v7
- id: "{{ .ProjectName }}-armv7"
goos: "linux"
goarch: "arm"
goarm: "7"
dockerfile: ".goreleaser.Dockerfile"
use: buildx
image_templates:
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
build_flag_templates:
- "--platform=linux/arm/v7"
- "--build-arg=VERSION={{ .Version }}"
- "--build-arg=VCS_REF={{ .FullCommit }}"
- "--build-arg=BUILD_DATE={{ .Date }}"
# Create Docker manifests for each image, containing the images for each
# supported system architecture.
docker_manifests:
# Docker Hub
- name_template: "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:latest"
image_templates:
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
- name_template: "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
- name_template: "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}"
image_templates:
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "{{ .Env.DOCKER_HUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
# GitHub Container Registry
- name_template: "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:latest"
image_templates:
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
- name_template: "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
- name_template: "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}"
image_templates:
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-arm64"
- "ghcr.io/{{ .Env.GITHUB_USER }}/{{ .ProjectName }}:{{ .Version }}-armv7"
# Sign Docker images and manifests.
docker_signs:
- artifacts: "all"
cmd: "cosign"
args:
- "sign"
- "${artifact}"
- "--yes"
# Snapshot version settings.
snapshot:
version_template: "{{ incpatch .Version }}-dev-{{ .ShortCommit }}"
# Generate changelog for releases.
changelog:
use: "github-native"
# Create GitHub release.
release:
name_template: "starlink_exporter v{{ .Version }}"
github:
owner: "joshuasing"
name: "starlink_exporter"
prerelease: auto
mode: "append"
footer: |
**Full Changelog**: https://github.com/joshuasing/starlink_exporter/compare/{{ .PreviousTag }}...{{ .Tag }}
# Close milestones for the released tag.
milestones:
- repo:
owner: "joshuasing"
name: "starlink_exporter"
close: true
name_template: "{{ .Tag }}"