Skip to content

Commit 6fc82e1

Browse files
committed
prepare provider for gha release workflow
1 parent c617423 commit 6fc82e1

File tree

5 files changed

+107
-60
lines changed

5 files changed

+107
-60
lines changed

.github/workflows/release.yml

+47-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,52 @@
1-
name: Post Publish
1+
name: Release
2+
23
on:
3-
release:
4-
types: [published]
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
permissions:
9+
contents: write
10+
511
jobs:
12+
go-version:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.go-version.outputs.version }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
- id: go-version
19+
run: echo "::set-output name=version::$(cat ./.go-version)"
20+
release-notes:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0
26+
- name: Generate Release Notes
27+
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
28+
- uses: actions/upload-artifact@v2
29+
with:
30+
name: release-notes
31+
path: release-notes.txt
32+
retention-days: 1
33+
terraform-provider-release:
34+
name: 'Terraform Provider Release'
35+
needs: [go-version, release-notes]
36+
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/hashicorp.yml@v1
37+
secrets:
38+
hc-releases-aws-access-key-id: '${{ secrets.TF_PROVIDER_RELEASE_AWS_ACCESS_KEY_ID }}'
39+
hc-releases-aws-secret-access-key: '${{ secrets.TF_PROVIDER_RELEASE_AWS_SECRET_ACCESS_KEY }}'
40+
hc-releases-aws-role-arn: '${{ secrets.TF_PROVIDER_RELEASE_AWS_ROLE_ARN }}'
41+
hc-releases-fastly-api-token: '${{ secrets.HASHI_FASTLY_PURGE_TOKEN }}'
42+
hc-releases-github-token: '${{ secrets.HASHI_RELEASES_GITHUB_TOKEN }}'
43+
hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}'
44+
setup-signore-github-token: '${{ secrets.HASHI_SIGNORE_GITHUB_TOKEN }}'
45+
signore-client-id: '${{ secrets.SIGNORE_CLIENT_ID }}'
46+
signore-client-secret: '${{ secrets.SIGNORE_CLIENT_SECRET }}'
47+
with:
48+
release-notes: true
49+
setup-go-version: '${{ needs.go-version.outputs.version }}'
650
tidy:
751
name: Tidy Asana
852
runs-on: ubuntu-latest

.goreleaser.yml

+54-26
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,75 @@
11
archives:
22
- files:
3-
- none*
3+
# Ensure only built binary is archived
4+
- 'none*'
45
format: zip
56
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
67
before:
78
hooks:
8-
- go mod download
9+
- 'go mod download'
910
builds:
10-
- binary: '{{ .ProjectName }}_{{ .Version }}'
11+
- # Binary naming only required for Terraform CLI 0.12
12+
binary: '{{ .ProjectName }}_v{{ .Version }}_x5'
13+
env:
14+
- CGO_ENABLED=0
1115
flags:
1216
- -trimpath
13-
goarch:
14-
- '386'
15-
- amd64
16-
- arm
17-
- arm64
1817
goos:
1918
- darwin
2019
- freebsd
2120
- linux
2221
- windows
22+
goarch:
23+
- '386'
24+
- amd64
25+
- arm
26+
- arm64
2327
ignore:
24-
- goarch: '386'
25-
goos: darwin
28+
- goarch: arm
29+
goos: windows
30+
- goarch: arm64
31+
goos: freebsd
32+
- goarch: arm64
33+
goos: windows
2634
ldflags:
27-
- -s -w -X version.ProviderVersion={{.Version}}
35+
- -s -w -X main.Version={{.Version}}
2836
mod_timestamp: '{{ .CommitTimestamp }}'
29-
changelog:
30-
skip: true
3137
checksum:
32-
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
3338
algorithm: sha256
34-
env:
35-
- CGO_ENABLED=0
39+
extra_files:
40+
- glob: 'terraform-registry-manifest.json'
41+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
42+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
43+
publishers:
44+
- checksum: true
45+
# Terraform CLI 0.10 - 0.11 perform discovery via HTTP headers on releases.hashicorp.com
46+
# For providers which have existed since those CLI versions, exclude
47+
# discovery by setting the protocol version headers to 5.
48+
cmd: hc-releases upload-file {{ abs .ArtifactPath }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0
49+
env:
50+
- AWS_ACCESS_KEY_ID={{ .Env.AWS_ACCESS_KEY_ID }}
51+
- AWS_SECRET_ACCESS_KEY={{ .Env.AWS_SECRET_ACCESS_KEY }}
52+
- AWS_SESSION_TOKEN={{ .Env.AWS_SESSION_TOKEN }}
53+
extra_files:
54+
- glob: 'terraform-registry-manifest.json'
55+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
56+
name: hc-releases
57+
signature: true
3658
release:
37-
disable: true
59+
extra_files:
60+
- glob: 'terraform-registry-manifest.json'
61+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
62+
ids:
63+
- none
3864
signs:
39-
- artifacts: checksum
40-
args:
41-
- "--batch"
42-
- "--local-user"
43-
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
44-
- "--output"
45-
- "${signature}"
46-
- "--detach-sign"
47-
- "${artifact}"
65+
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
66+
artifacts: checksum
67+
cmd: signore
68+
signature: ${artifact}.sig
69+
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
70+
artifacts: checksum
71+
cmd: signore
72+
id: key-id
73+
signature: ${artifact}.72D7468F.sig
74+
snapshot:
75+
name_template: "{{ .Tag }}-next"

.tfproto5

Whitespace-only changes.

scripts/changelog-links.sh

-31
This file was deleted.

terraform-registry-manifest.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": 1,
3+
"metadata": {
4+
"protocol_versions": ["5.0"]
5+
}
6+
}

0 commit comments

Comments
 (0)