release.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Terraform Provider release workflow.
  2. name: Release
  3. # This GitHub action creates a release when a tag that matches the pattern
  4. # "v*" (e.g. v0.1.0) is created.
  5. on:
  6. push:
  7. tags:
  8. - 'v*'
  9. # Releases need permissions to read and write the repository contents.
  10. # GitHub considers creating releases and uploading assets as writing contents.
  11. permissions:
  12. contents: write
  13. # Default values to simplify job configurations below.
  14. env:
  15. # Go language version to use for building. This value should also be updated
  16. # in the testing workflow if changed.
  17. GO_VERSION: '1.17'
  18. jobs:
  19. goreleaser:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v3
  23. with:
  24. # Allow goreleaser to access older tag information.
  25. fetch-depth: 0
  26. - uses: actions/setup-go@v2
  27. with:
  28. go-version: ${{ env.GO_VERSION }}
  29. # This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
  30. # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
  31. # secret. If you would rather own your own GPG handling, please fork this action
  32. # or use an alternative one for key handling.
  33. - name: Import GPG key
  34. id: import_gpg
  35. uses: hashicorp/ghaction-import-gpg@v2.1.0
  36. env:
  37. # These secrets will need to be configured for the repository:
  38. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  39. PASSPHRASE: ${{ secrets.PASSPHRASE }}
  40. - name: Run GoReleaser
  41. uses: goreleaser/goreleaser-action@v2.9.1
  42. with:
  43. args: release --rm-dist
  44. env:
  45. # GitHub sets the GITHUB_TOKEN secret automatically.
  46. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  47. GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}