1
- # This GitHub action can publish assets for release when a tag is created.
2
- # Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
3
- #
4
- # This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
5
- # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
6
- # secret. If you would rather own your own GPG handling, please fork this action
7
- # or use an alternative one for key handling.
8
- #
9
- # You will need to pass the `--batch` flag to `gpg` in your signing step
10
- # in `goreleaser` to indicate this is being used in a non-interactive mode.
11
- #
1
+
2
+ # Terraform Provider release workflow.
12
3
name : release
4
+
5
+ # This GitHub action creates a release when a tag that matches the pattern
6
+ # "v*" (e.g. v0.1.0) is created.
13
7
on :
14
8
push :
15
9
tags :
16
10
- ' v*'
17
- workflow_dispatch :
11
+
12
+ # Releases need permissions to read and write the repository contents.
13
+ # GitHub considers creating releases and uploading assets as writing contents.
14
+ permissions :
15
+ contents : write
18
16
19
17
jobs :
20
18
goreleaser :
21
- runs-on : ubuntu-20.04
19
+ runs-on : ubuntu-latest
22
20
steps :
23
- -
24
- name : Checkout
25
- uses : actions/checkout@v2
26
- -
27
- name : Unshallow
28
- run : git fetch --prune --unshallow
29
- -
30
- name : Set up Go
31
- uses : actions/setup-go@v2
21
+ - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
32
22
with :
33
- go-version : ' 1.21'
34
- -
35
- name : Import GPG key
23
+ # Allow goreleaser to access older tag information.
24
+ fetch-depth : 0
25
+ - uses : actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
26
+ with :
27
+ go-version-file : ' go.mod'
28
+ cache : true
29
+ - name : Import GPG key
30
+ uses : crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
36
31
id : import_gpg
37
-
38
- env :
39
- GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
40
- PASSPHRASE : ${{ secrets.PASSPHRASE }}
41
- -
42
- name : Run GoReleaser
43
- uses : goreleaser/goreleaser-action@v2
44
32
with :
45
- version : latest
33
+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
34
+ passphrase : ${{ secrets.PASSPHRASE }}
35
+ - name : Run GoReleaser
36
+ uses : goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
37
+ with :
46
38
args : release --clean
47
39
env :
48
- GPG_FINGERPRINT : ${{ steps.import_gpg.outputs.fingerprint }}
40
+ # GitHub sets the GITHUB_TOKEN secret automatically.
49
41
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42
+ GPG_FINGERPRINT : ${{ steps.import_gpg.outputs.fingerprint }}
0 commit comments