Skip to content

Commit cce0162

Browse files
committed
chore(xfer): update release workflow (#2408)
Post-transfer update of the release workflow. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent 9a353a3 commit cce0162

File tree

4 files changed

+69
-98
lines changed

4 files changed

+69
-98
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
1+
---
12
name: Release
23

34
on:
45
push:
56
tags:
6-
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
- v*
78

89
permissions:
9-
contents: write
10+
contents: read
1011

1112
jobs:
12-
release-notes:
13+
release:
1314
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
1417
steps:
15-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1620
with:
1721
fetch-depth: 0
18-
- name: Generate Release Notes
19-
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt
20-
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
22+
- name: Setup Go
23+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2124
with:
22-
name: release-notes
23-
path: release-notes.txt
24-
retention-days: 1
25-
terraform-provider-release:
26-
name: 'Terraform Provider Release'
27-
needs: [release-notes]
28-
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/hashicorp.yml@v4.0.1
29-
secrets:
30-
hc-releases-key-prod: '${{ secrets.HC_RELEASES_KEY_PROD }}'
31-
hc-releases-key-staging: '${{ secrets.HC_RELEASES_KEY_STAGING }}'
32-
hc-releases-github-token: '${{ secrets.HASHI_RELEASES_GITHUB_TOKEN }}'
33-
hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}'
34-
setup-signore-github-token: '${{ secrets.HASHI_SIGNORE_GITHUB_TOKEN }}'
35-
signore-client-id: '${{ secrets.SIGNORE_CLIENT_ID }}'
36-
signore-client-secret: '${{ secrets.SIGNORE_CLIENT_SECRET }}'
37-
hc-releases-host-staging: '${{ secrets.HC_RELEASES_HOST_STAGING }}'
38-
hc-releases-host-prod: '${{ secrets.HC_RELEASES_HOST_PROD }}'
39-
with:
40-
release-notes: true
41-
setup-go-version-file: '.go-version'
42-
# Product Version (e.g. v1.2.3 or github.ref_name)
43-
product-version: '${{ github.ref_name }}'
25+
go-version-file: go.mod
26+
- name: Import GPG Key
27+
id: import_gpg
28+
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
29+
with:
30+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
31+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
32+
- name: Run GoReleaser
33+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
34+
with:
35+
version: latest
36+
args: release --clean --timeout 60m --release-header-tmpl .goreleaser.tmpl
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.go-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.goreleaser.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Release {{ .Version }} ({{ .Date }})

.goreleaser.yml

Lines changed: 43 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,64 @@
1-
# Copyright (c) HashiCorp, Inc.
2-
# SPDX-License-Identifier: MPL-2.0
3-
1+
---
42
version: 2
5-
archives:
6-
- files:
7-
# Ensure only built binary and license file are archived
8-
- src: 'LICENSE'
9-
dst: 'LICENSE.txt'
10-
formats: ['zip']
11-
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
3+
4+
project_name: terraform-provider-vsphere
5+
6+
before:
7+
hooks:
8+
- go mod tidy
9+
1210
builds:
13-
- # Special binary naming is only necessary for Terraform CLI 0.12
14-
binary: '{{ .ProjectName }}_v{{ .Version }}_x5'
15-
env:
16-
- CGO_ENABLED=0
17-
flags:
18-
- -trimpath
11+
- id: default
12+
binary: '{{ .ProjectName }}_v{{ .Version }}'
1913
goos:
20-
- darwin
21-
- freebsd
2214
- linux
2315
- windows
16+
- darwin
17+
- freebsd
2418
goarch:
25-
- '386'
2619
- amd64
20+
- '386'
2721
- arm
2822
- arm64
2923
ignore:
30-
- goarch: arm
31-
goos: windows
32-
- goarch: arm64
33-
goos: freebsd
34-
- goarch: arm64
35-
goos: windows
24+
- goos: darwin
25+
goarch: '386'
26+
env:
27+
- CGO_ENABLED=0
28+
flags:
29+
- -trimpath
3630
ldflags:
37-
- -s -w -X internal/provider.Version={{.Version}}
31+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
3832
mod_timestamp: '{{ .CommitTimestamp }}'
33+
34+
archives:
35+
- id: default
36+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
37+
formats: ['zip']
38+
3939
checksum:
40-
extra_files:
41-
- glob: 'terraform-registry-manifest.json'
42-
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
4340
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
4441
algorithm: sha256
45-
publishers:
46-
- name: upload
47-
checksum: true
48-
extra_files:
49-
- glob: 'terraform-registry-manifest.json'
50-
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
51-
signature: true
52-
env:
53-
- HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }}
54-
- HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }}
55-
cmd: |
56-
hc-releases upload -product {{ .ProjectName }} -version {{ .Version }} -file={{ .ArtifactPath }}={{ .ArtifactName }} -header="x-terraform-protocol-version=5.0" -header="x-terraform-protocol-versions=5.0"
57-
release:
5842
extra_files:
5943
- glob: 'terraform-registry-manifest.json'
6044
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
61-
ids:
62-
- none
45+
6346
signs:
64-
# Default Signature file (i.e. terraform-provider-NAME_VERSION_SHA256SUMS.sig)
65-
- cmd: sh
66-
args:
67-
- -c
68-
- >-
69-
signore
70-
sign
71-
--dearmor
72-
--file ${artifact}
73-
--out ${signature}
47+
- id: default
7448
artifacts: checksum
75-
# Signature file with GPG Public Key ID in filename (i.e. terraform-provider-NAME_VERSION_SHA256SUMS.7685B676.sig)
76-
- id: sig-with-gpg-public-key-id
77-
signature: ${artifact}.72D7468F.sig
78-
cmd: sh
7949
args:
80-
- -c
81-
- >-
82-
signore
83-
sign
84-
--dearmor
85-
--file ${artifact}
86-
--out ${signature}
87-
artifacts: checksum
88-
snapshot:
89-
version_template: "{{ .Tag }}-next"
50+
- "--batch"
51+
- "--local-user"
52+
- "{{ .Env.GPG_FINGERPRINT }}"
53+
- "--output"
54+
- "${signature}"
55+
- "--detach-sign"
56+
- "${artifact}"
57+
58+
release:
59+
extra_files:
60+
- glob: 'terraform-registry-manifest.json'
61+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
62+
63+
changelog:
64+
disable: true

0 commit comments

Comments
 (0)