fix: goreleaser tag race condition (#188)

Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
Matt Trachier 2025-09-19 23:17:15 -05:00 committed by GitHub
parent d7c83ba1ea
commit bd0cb43401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 91 additions and 23 deletions

View File

@ -74,7 +74,7 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
with:
args: release --clean
args: release --clean --config .goreleaser_rc.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}

View File

@ -129,9 +129,9 @@ jobs:
echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; }
- name: Run GoReleaser
if: steps.release-please.outputs.version
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
with:
args: release --clean
args: release --clean --config .goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}

View File

@ -6,27 +6,33 @@ version: 2
before:
hooks:
- go mod tidy
git:
ignore_tags:
- "*rc*"
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like HCP Terraform where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- arm
- arm64
binary: '{{ .ProjectName }}_v{{ .Version }}'
- binary: '{{ .ProjectName }}_v{{ .Version }}'
env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like HCP Terraform where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- arm
- arm64
ignore:
- goos: windows
goarch: arm
archives:
- formats: [ 'zip' ]
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'

62
.goreleaser_rc.yml Normal file
View File

@ -0,0 +1,62 @@
# https://goreleaser.com for documentation
version: 2
before:
hooks:
- go mod tidy
builds:
- binary: '{{ .ProjectName }}_v{{ .Version }}'
env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like HCP Terraform where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- arm
- arm64
ignore:
- goos: windows
goarch: arm
archives:
- formats: [ 'zip' ]
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--detach-sig"
- "--pinentry-mode"
- "loopback"
- "--passphrase"
- "{{ .Env.GPG_PASSPHRASE }}"
- "--local-user"
- "{{ .Env.GPG_KEY_ID }}"
- "--output"
- "${signature}"
- "--sign"
- "${artifact}"
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
prerelease: auto
changelog:
disable: true