|
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 (hashicorp/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 | | -# |
12 | | -name: release |
| 1 | +# Terraform Provider release workflow. |
| 2 | +name: Release |
| 3 | + |
| 4 | +# This GitHub action creates a release when a tag that matches the pattern |
| 5 | +# "v*" (e.g. v0.1.0) is created. |
13 | 6 | on: |
14 | 7 | push: |
15 | 8 | tags: |
16 | 9 | - 'v*' |
| 10 | + |
| 11 | +# Releases need permissions to read and write the repository contents. |
| 12 | +# GitHub considers creating releases and uploading assets as writing contents. |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + |
17 | 16 | jobs: |
18 | 17 | goreleaser: |
19 | 18 | runs-on: ubuntu-latest |
20 | 19 | steps: |
21 | | - - |
22 | | - name: Checkout |
23 | | - uses: actions/checkout@v3 |
24 | | - - |
25 | | - name: Unshallow |
26 | | - run: git fetch --prune --unshallow |
27 | | - - |
28 | | - name: Set up Go |
29 | | - uses: actions/setup-go@v3 |
| 20 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 21 | + with: |
| 22 | + # Allow goreleaser to access older tag information. |
| 23 | + fetch-depth: 0 |
| 24 | + - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 |
30 | 25 | with: |
31 | 26 | go-version-file: 'go.mod' |
32 | 27 | cache: true |
33 | | - - |
34 | | - name: Import GPG key |
| 28 | + - name: Import GPG key |
| 29 | + uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0 |
35 | 30 | id: import_gpg |
36 | | - uses: crazy-max/ghaction-import-gpg@v5 |
37 | 31 | with: |
38 | | - # These secrets will need to be configured for the repository: |
39 | 32 | gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
40 | 33 | passphrase: ${{ secrets.PASSPHRASE }} |
41 | | - - |
42 | | - name: Run GoReleaser |
43 | | - uses: goreleaser/[email protected] |
| 34 | + - name: Run GoReleaser |
| 35 | + uses: goreleaser/goreleaser-action@026299872805cb2db698e02dd7fb506a4da5122d # v6.2.0 |
44 | 36 | with: |
45 | | - version: '~> v1' |
46 | | - args: release --rm-dist |
| 37 | + args: release --clean |
47 | 38 | env: |
48 | | - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
49 | | - # GitHub sets this automatically |
| 39 | + # GitHub sets the GITHUB_TOKEN secret automatically. |
50 | 40 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
0 commit comments