Merge pull request #12318 from cli/babakks/upgrade-to-goreleaser-v2

ci: upgrade to GoReleaser `v2`
This commit is contained in:
Babak K. Shandiz 2025-12-19 19:12:19 +00:00 committed by GitHub
commit 146e886761
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 22 deletions

View file

@ -50,9 +50,11 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: "~1.17.1"
# The version is pinned not only for security purposes, but also to avoid breaking
# our scripts, which rely on the specific file names generated by GoReleaser.
version: v2.13.1
install-only: true
- name: Build release binaries
env:
@ -103,9 +105,11 @@ jobs:
security set-key-partition-list -S "apple-tool:,apple:,codesign:" -s -k "$keychain_password" "$keychain"
rm "$RUNNER_TEMP/cert.p12"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: "~1.17.1"
# The version is pinned not only for security purposes, but also to avoid breaking
# our scripts, which rely on the specific file names generated by GoReleaser.
version: v2.13.1
install-only: true
- name: Build release binaries
env:
@ -157,9 +161,11 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: "~1.17.1"
# The version is pinned not only for security purposes, but also to avoid breaking
# our scripts, which rely on the specific file names generated by GoReleaser.
version: v2.13.1
install-only: true
- name: Install Azure Code Signing Client
shell: pwsh
@ -207,7 +213,7 @@ jobs:
MSI_VERSION="$(cut -d_ -f2 <<<"$MSI_NAME" | cut -d- -f1)"
case "$MSI_NAME" in
*_386 )
source_dir="$PWD/dist/windows_windows_386"
source_dir="$PWD/dist/windows_windows_386_sse2"
platform="x86"
;;
*_amd64 )
@ -215,7 +221,7 @@ jobs:
platform="x64"
;;
*_arm64 )
source_dir="$PWD/dist/windows_windows_arm64"
source_dir="$PWD/dist/windows_windows_arm64_v8.0"
platform="arm64"
;;
* )

View file

@ -1,3 +1,5 @@
version: 2
project_name: gh
release:
@ -28,7 +30,7 @@ builds:
- id: linux #build:linux
goos: [linux]
goarch: [386, arm, amd64, arm64]
goarch: ["386", arm, amd64, arm64]
env:
- CGO_ENABLED=0
binary: bin/gh
@ -38,7 +40,7 @@ builds:
- id: windows #build:windows
goos: [windows]
goarch: [386, amd64, arm64]
goarch: ["386", amd64, arm64]
hooks:
post:
- cmd: pwsh .\script\sign.ps1 '{{ .Path }}'
@ -50,34 +52,32 @@ builds:
archives:
- id: linux-archive
builds: [linux]
ids: [linux]
name_template: "gh_{{ .Version }}_linux_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: true
format: tar.gz
rlcp: true
formats: [tar.gz]
files:
- LICENSE
- ./share/man/man1/gh*.1
- id: macos-archive
builds: [macos]
ids: [macos]
name_template: "gh_{{ .Version }}_macOS_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: true
format: zip
rlcp: true
formats: [zip]
files:
- LICENSE
- ./share/man/man1/gh*.1
- id: windows-archive
builds: [windows]
ids: [windows]
name_template: "gh_{{ .Version }}_windows_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: false
format: zip
rlcp: true
formats: [zip]
files:
- LICENSE
nfpms: #build:linux
- license: MIT
- ids: [linux]
license: MIT
maintainer: GitHub
homepage: https://github.com/cli/cli
bindir: /usr

View file

@ -58,7 +58,7 @@ fi
# gh-binary paths
bin_path="/bin/gh"
arm64_bin="./dist/macos_darwin_arm64$bin_path"
arm64_bin="./dist/macos_darwin_arm64_v8.0$bin_path"
amd64_bin="./dist/macos_darwin_amd64_v1$bin_path"
# payload paths
payload_root="pkg_payload"

View file

@ -94,7 +94,7 @@ build_local() {
;;
esac
[ -z "$tag_name" ] || export GORELEASER_CURRENT_TAG="$tag_name"
announce goreleaser release -f "$goreleaser_config" --clean --skip-validate --skip-publish --release-notes="$(mktemp)"
announce goreleaser release -f "$goreleaser_config" --clean --skip validate,publish,announce --release-notes="$(mktemp)"
}
if [ -n "$is_local" ]; then