Skip to content

Commit d3b9b00

Browse files
committed
refactor: update goreleaser
Streamlines the release configuration and updates to v2. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent 75b32d0 commit d3b9b00

1 file changed

Lines changed: 28 additions & 25 deletions

File tree

.goreleaser.yml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
---
2+
# This configuration file is used by GoReleaser for the release process.
3+
4+
version: 2
5+
26
env:
37
- CGO_ENABLED=0
8+
49
before:
510
hooks:
6-
# We strongly recommend running tests to catch any regression before release.
7-
# Even though, this an optional step.
11+
# Clean up any cached test data.
12+
- go clean -testcache
13+
# Run tests to ensure that the plugin is compatible with the current version of Packer.
814
- go test ./...
9-
# Check plugin compatibility with required version of the Packer SDK
15+
# Check plugin compatibility with required version of the Packer SDK.
1016
- make plugin-check
11-
# Copy LICENSE file for inclusion in zip archive
17+
# Copy LICENSE file for inclusion in zip archive.
1218
- cp LICENSE LICENSE.txt
19+
1320
builds:
14-
# A separated build to run the packer-plugins-check only once for a linux_amd64 binary
15-
-
16-
id: plugin-check
21+
- id: plugin-check
1722
mod_timestamp: '{{ .CommitTimestamp }}'
1823
flags:
19-
- -trimpath #removes all file system paths from the compiled executable
24+
- -trimpath
2025
ldflags:
2126
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
2227
goos:
2328
- linux
2429
goarch:
2530
- amd64
2631
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
27-
-
28-
id: linux-builds
32+
- id: linux-builds
2933
mod_timestamp: '{{ .CommitTimestamp }}'
3034
flags:
31-
- -trimpath #removes all file system paths from the compiled executable
35+
- -trimpath
3236
ldflags:
3337
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
3438
goos:
@@ -42,11 +46,10 @@ builds:
4246
- goos: linux
4347
goarch: amd64
4448
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
45-
-
46-
id: darwin-builds
49+
- id: darwin-builds
4750
mod_timestamp: '{{ .CommitTimestamp }}'
4851
flags:
49-
- -trimpath #removes all file system paths from the compiled executable
52+
- -trimpath
5053
ldflags:
5154
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
5255
goos:
@@ -55,11 +58,10 @@ builds:
5558
- amd64
5659
- arm64
5760
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
58-
-
59-
id: other-builds
61+
- id: other-builds
6062
mod_timestamp: '{{ .CommitTimestamp }}'
6163
flags:
62-
- -trimpath #removes all file system paths from the compiled executable
64+
- -trimpath
6365
ldflags:
6466
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
6567
goos:
@@ -80,20 +82,21 @@ builds:
8082
- goos: solaris
8183
goarch: '386'
8284
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
85+
8386
archives:
84-
- format: zip
85-
files:
86-
- "LICENSE.txt"
87+
- id: default
88+
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
89+
files:
90+
- "LICENSE.txt"
91+
formats: ['zip']
8792

88-
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
8993
checksum:
9094
name_template: '{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS'
9195
algorithm: sha256
96+
9297
signs:
93-
- artifacts: checksum
94-
args:
95-
# if you are using this is in a GitHub action or some other automated pipeline, you
96-
# need to pass the batch flag to indicate its not interactive.
98+
- artifacts: checksum
99+
args:
97100
- "--batch"
98101
- "--local-user"
99102
- "{{ .Env.GPG_FINGERPRINT }}"

0 commit comments

Comments
 (0)