|
| 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 | +# Default values to simplify job configurations below. |
| 17 | +env: |
| 18 | + # Go language version to use for building. This value should also be updated |
| 19 | + # in the testing workflow if changed. |
| 20 | + GO_VERSION: '1.17' |
| 21 | + |
| 22 | +jobs: |
| 23 | + goreleaser: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + with: |
| 28 | + # Allow goreleaser to access older tag information. |
| 29 | + fetch-depth: 0 |
| 30 | + - uses: actions/setup-go@v2 |
| 31 | + with: |
| 32 | + go-version: ${{ env.GO_VERSION }} |
| 33 | + # This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your |
| 34 | + # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` |
| 35 | + # secret. If you would rather own your own GPG handling, please fork this action |
| 36 | + # or use an alternative one for key handling. |
| 37 | + - name: Import GPG key |
| 38 | + id: import_gpg |
| 39 | + |
| 40 | + env: |
| 41 | + # These secrets will need to be configured for the repository: |
| 42 | + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
| 43 | + PASSPHRASE: ${{ secrets.PASSPHRASE }} |
| 44 | + - name: Run GoReleaser |
| 45 | + uses: goreleaser/[email protected] |
| 46 | + with: |
| 47 | + args: release --rm-dist |
| 48 | + env: |
| 49 | + # GitHub sets the GITHUB_TOKEN secret automatically. |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
0 commit comments