|
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 |
| -# |
12 |
| -name: release |
13 |
| -on: |
14 |
| - push: |
15 |
| - tags: |
16 |
| - - 'v*' |
17 |
| -jobs: |
18 |
| - goreleaser: |
19 |
| - runs-on: ubuntu-latest |
20 |
| - strategy: |
21 |
| - matrix: |
22 |
| - go: [ '1.19', '1.20' ] |
23 |
| - steps: |
24 |
| - - name: Checkout |
25 |
| - uses: actions/checkout@v3 |
26 |
| - |
27 |
| - - name: Unshallow |
28 |
| - run: git fetch --prune --unshallow |
29 |
| - |
30 |
| - - name: Set up Go |
31 |
| - uses: actions/setup-go@v4 |
32 |
| - with: |
33 |
| - go-version: ${{ matrix.go }} |
34 |
| - |
35 |
| - - name: Import GPG key |
36 |
| - id: import_gpg |
37 |
| - |
38 |
| - with: |
39 |
| - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
40 |
| - passphrase: ${{ secrets.GPG_PASSPHRASE }} |
41 |
| - |
42 |
| - - name: Run GoReleaser |
43 |
| - uses: goreleaser/goreleaser-action@v4 |
44 |
| - with: |
45 |
| - version: latest |
46 |
| - args: release --rm-dist |
47 |
| - env: |
48 |
| - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
49 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 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. |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 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 | + |
| 16 | +jobs: |
| 17 | + goreleaser: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + |
| 21 | + with: |
| 22 | + # Allow goreleaser to access older tag information. |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + with: |
| 26 | + go-version-file: 'go.mod' |
| 27 | + cache: true |
| 28 | + - name: Import GPG key |
| 29 | + |
| 30 | + id: import_gpg |
| 31 | + with: |
| 32 | + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 33 | + passphrase: ${{ secrets.PASSPHRASE }} |
| 34 | + - name: Run GoReleaser |
| 35 | + uses: goreleaser/[email protected] |
| 36 | + with: |
| 37 | + args: release --clean |
| 38 | + env: |
| 39 | + # GitHub sets the GITHUB_TOKEN secret automatically. |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
0 commit comments