Skip to content

Commit 0898ca3

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 c188f66 commit 0898ca3

File tree

2 files changed

+54
-50
lines changed

2 files changed

+54
-50
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ jobs:
2525
outputs:
2626
go-version: ${{ steps.get-go-version.outputs.go-version }}
2727
steps:
28-
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
29-
- name: 'Determine Go version'
28+
- name: Checkout
29+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30+
- name: Get Go Version
3031
id: get-go-version
3132
run: |
3233
echo "Found Go $(cat .go-version)"
@@ -37,11 +38,11 @@ jobs:
3738
runs-on: ubuntu-latest
3839
steps:
3940
- name: Checkout
40-
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4142
- name: Unshallow
4243
run: git fetch --prune --unshallow
43-
- name: Set up Go
44-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
44+
- name: Setup Go
45+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
4546
with:
4647
go-version: ${{ needs.get-go-version.outputs.go-version }}
4748
- name: Describe plugin
@@ -54,10 +55,13 @@ jobs:
5455
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
5556
passphrase: ${{ secrets.GPG_PASSPHRASE }}
5657
- name: Run GoReleaser
57-
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
58+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
5859
with:
5960
version: latest
60-
args: release --clean --timeout 120m
61+
args: >
62+
release
63+
--clean
64+
--timeout 120m
6165
env:
6266
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
6367
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,67 @@
11
# SPDX-License-Identifier: MPL-2.0
22

3-
# This is an example goreleaser.yaml file with some defaults.
4-
# Make sure to check the documentation at http://goreleaser.com
3+
version: 2
4+
55
env:
66
- CGO_ENABLED=0
7+
78
before:
89
hooks:
9-
# We strongly recommend running tests to catch any regression before release.
10-
# Even though, this an optional step.
10+
# Clean up any cached test data.
11+
- go clean -testcache
12+
# Run tests to ensure that the plugin is compatible with the current version of Packer.
1113
- go test ./...
12-
# Check plugin compatibility with required version of the Packer SDK
14+
# Check plugin compatibility with required version of the Packer SDK.
1315
- make plugin-check
14-
# Copy LICENSE file for inclusion in zip archive
16+
# Copy LICENSE file for inclusion in zip archive.
1517
- cp LICENSE LICENSE.txt
18+
1619
builds:
17-
# A separated build to run the packer-plugins-check only once for a linux_amd64 binary
18-
-
19-
id: plugin-check
20-
mod_timestamp: '{{ .CommitTimestamp }}'
20+
- id: plugin-check
21+
mod_timestamp: "{{ .CommitTimestamp }}"
2122
flags:
22-
- -trimpath #removes all file system paths from the compiled executable
23+
- -trimpath
2324
ldflags:
24-
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
25+
- "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= "
2526
goos:
2627
- linux
2728
goarch:
2829
- amd64
29-
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
30-
-
31-
id: linux-builds
32-
mod_timestamp: '{{ .CommitTimestamp }}'
30+
binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
31+
- id: linux-builds
32+
mod_timestamp: "{{ .CommitTimestamp }}"
3333
flags:
34-
- -trimpath #removes all file system paths from the compiled executable
34+
- -trimpath
3535
ldflags:
36-
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
36+
- "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= "
3737
goos:
3838
- linux
3939
goarch:
4040
- amd64
41-
- '386'
42-
- arm
41+
- "386"
4342
- arm64
4443
ignore:
45-
- goos: linux
44+
- goos: linux # Already built during plugin-check.
4645
goarch: amd64
47-
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
48-
-
49-
id: darwin-builds
50-
mod_timestamp: '{{ .CommitTimestamp }}'
46+
binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
47+
- id: darwin-builds
48+
mod_timestamp: "{{ .CommitTimestamp }}"
5149
flags:
52-
- -trimpath #removes all file system paths from the compiled executable
50+
- -trimpath
5351
ldflags:
54-
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
52+
- "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= "
5553
goos:
5654
- darwin
5755
goarch:
5856
- amd64
5957
- arm64
60-
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
61-
-
62-
id: other-builds
63-
mod_timestamp: '{{ .CommitTimestamp }}'
58+
binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
59+
- id: other-builds
60+
mod_timestamp: "{{ .CommitTimestamp }}"
6461
flags:
65-
- -trimpath #removes all file system paths from the compiled executable
62+
- -trimpath
6663
ldflags:
67-
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
64+
- "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= "
6865
goos:
6966
- netbsd
7067
- openbsd
@@ -73,28 +70,31 @@ builds:
7370
- solaris
7471
goarch:
7572
- amd64
76-
- '386'
73+
- "386"
7774
- arm
7875
ignore:
7976
- goos: windows
8077
goarch: arm
8178
- goos: solaris
8279
goarch: arm
8380
- goos: solaris
84-
goarch: '386'
85-
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
81+
goarch: "386"
82+
binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
83+
8684
archives:
87-
- format: zip
88-
files:
89-
- "LICENSE.txt"
85+
- id: default
86+
name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
87+
files:
88+
- "LICENSE.txt"
89+
formats: ["zip"]
9090

91-
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
9291
checksum:
93-
name_template: '{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS'
92+
name_template: "{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS"
9493
algorithm: sha256
94+
9595
signs:
96-
- artifacts: checksum
97-
args:
96+
- artifacts: checksum
97+
args:
9898
# if you are using this is in a GitHub action or some other automated pipeline, you
9999
# need to pass the batch flag to indicate its not interactive.
100100
- "--batch"

0 commit comments

Comments
 (0)