Skip to content

Commit f14de36

Browse files
authored
add goreleaser and release from the scaffold repository (#8)
This copies the files wholesale. It makes some suspect changes to the release workflow, we'll want eyes on.
1 parent ca14164 commit f14de36

File tree

2 files changed

+78
-21
lines changed

2 files changed

+78
-21
lines changed

.github/workflows/release.yml

+17-21
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
1+
# Terraform Provider release workflow.
12
name: Release
23

4+
# This GitHub action creates a release when a tag that matches the pattern
5+
# "v*" (e.g. v0.1.0) is created.
36
on:
47
push:
58
tags:
69
- 'v*'
710

11+
# Releases need permissions to read and write the repository contents.
12+
# GitHub considers creating releases and uploading assets as writing contents.
813
permissions:
914
contents: write
1015

1116
jobs:
12-
release:
17+
goreleaser:
1318
runs-on: ubuntu-latest
1419
steps:
15-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1621
with:
22+
# Allow goreleaser to access older tag information.
1723
fetch-depth: 0
18-
19-
- name: Set up Go
20-
uses: actions/setup-go@v4
24+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
2125
with:
22-
go-version: '1.23'
26+
go-version-file: 'go.mod'
2327
cache: true
24-
2528
- name: Import GPG key
29+
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
2630
id: import_gpg
27-
uses: crazy-max/ghaction-import-gpg@v6
2831
with:
2932
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
30-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
31-
32-
- name: Generate release notes
33-
run: |
34-
echo "# Release notes" > release-notes.txt
35-
git log --pretty=format:"* %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> release-notes.txt
36-
37-
- name: Create GitHub Release
38-
uses: softprops/action-gh-release@v1
33+
passphrase: ${{ secrets.PASSPHRASE }}
34+
- name: Run GoReleaser
35+
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
3936
with:
40-
body_path: release-notes.txt
41-
token: ${{ secrets.GITHUB_TOKEN }}
42-
files: |
43-
terraform-provider-pomerium_*
37+
args: release --clean
4438
env:
39+
# GitHub sets the GITHUB_TOKEN secret automatically.
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4541
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.goreleaser.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
version: 2
4+
before:
5+
hooks:
6+
# this is just an example and not a requirement for provider building/publishing
7+
- go mod tidy
8+
builds:
9+
- env:
10+
# goreleaser does not work with CGO, it could also complicate
11+
# usage by users in CI/CD systems like HCP Terraform where
12+
# they are unable to install libraries.
13+
- CGO_ENABLED=0
14+
mod_timestamp: '{{ .CommitTimestamp }}'
15+
flags:
16+
- -trimpath
17+
ldflags:
18+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
19+
goos:
20+
- freebsd
21+
- windows
22+
- linux
23+
- darwin
24+
goarch:
25+
- amd64
26+
- '386'
27+
- arm
28+
- arm64
29+
ignore:
30+
- goos: darwin
31+
goarch: '386'
32+
binary: '{{ .ProjectName }}_v{{ .Version }}'
33+
archives:
34+
- format: zip
35+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
36+
checksum:
37+
extra_files:
38+
- glob: 'terraform-registry-manifest.json'
39+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
40+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
41+
algorithm: sha256
42+
signs:
43+
- artifacts: checksum
44+
args:
45+
# if you are using this in a GitHub action or some other automated pipeline, you
46+
# need to pass the batch flag to indicate its not interactive.
47+
- "--batch"
48+
- "--local-user"
49+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
50+
- "--output"
51+
- "${signature}"
52+
- "--detach-sign"
53+
- "${artifact}"
54+
release:
55+
extra_files:
56+
- glob: 'terraform-registry-manifest.json'
57+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
58+
# If you want to manually examine the release before its live, uncomment this line:
59+
# draft: true
60+
changelog:
61+
disable: true

0 commit comments

Comments
 (0)