Skip to content

Commit 5d882aa

Browse files
authored
Migrate to GitHub Actions Release Process (#90)
Reference: #79
1 parent 3dbde02 commit 5d882aa

File tree

4 files changed

+124
-5
lines changed

4 files changed

+124
-5
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
permissions:
9+
contents: write
10+
11+
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.FASTLY_STATIC_PURGE_TOKEN }}'
42+
hc-releases-github-token: '${{ secrets.HC_RELEASES_TOKEN }}'
43+
hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}'
44+
setup-signore-github-token: '${{ secrets.SETUP_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 }}'

.goreleaser.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
archives:
2+
- files:
3+
# Ensure only built binary is archived
4+
- 'none*'
5+
format: zip
6+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
7+
before:
8+
hooks:
9+
- 'go mod download'
10+
builds:
11+
- # Binary naming only required for Terraform CLI 0.12
12+
binary: '{{ .ProjectName }}_v{{ .Version }}_x5'
13+
env:
14+
- CGO_ENABLED=0
15+
flags:
16+
- -trimpath
17+
goos:
18+
- darwin
19+
- freebsd
20+
- linux
21+
- windows
22+
goarch:
23+
- '386'
24+
- amd64
25+
- arm
26+
- arm64
27+
ignore:
28+
- goarch: arm
29+
goos: windows
30+
- goarch: arm64
31+
goos: freebsd
32+
- goarch: arm64
33+
goos: windows
34+
ldflags:
35+
- -s -w -X main.Version={{.Version}}
36+
mod_timestamp: '{{ .CommitTimestamp }}'
37+
checksum:
38+
algorithm: sha256
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+
cmd: hc-releases upload-file {{ abs .ArtifactPath }}
46+
env:
47+
- AWS_ACCESS_KEY_ID={{ .Env.AWS_ACCESS_KEY_ID }}
48+
- AWS_SECRET_ACCESS_KEY={{ .Env.AWS_SECRET_ACCESS_KEY }}
49+
- AWS_SESSION_TOKEN={{ .Env.AWS_SESSION_TOKEN }}
50+
name: hc-releases
51+
signature: true
52+
release:
53+
extra_files:
54+
- glob: 'terraform-registry-manifest.json'
55+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
56+
ids:
57+
- none
58+
signs:
59+
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
60+
artifacts: checksum
61+
cmd: signore
62+
signature: ${artifact}.sig
63+
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
64+
artifacts: checksum
65+
cmd: signore
66+
id: key-id
67+
signature: ${artifact}.72D7468F.sig
68+
snapshot:
69+
name_template: "{{ .Tag }}-next"

.tfproto5

Lines changed: 0 additions & 5 deletions
This file was deleted.

terraform-registry-manifest.json

Lines changed: 6 additions & 0 deletions
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)