release.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. jobs:
  14. goreleaser:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v3
  18. with:
  19. # Allow goreleaser to access older tag information.
  20. fetch-depth: 0
  21. - uses: actions/setup-go@v3
  22. with:
  23. go-version-file: 'go.mod'
  24. cache: true
  25. # This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
  26. # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
  27. # secret. If you would rather own your own GPG handling, please fork this action
  28. # or use an alternative one for key handling.
  29. - name: Import GPG key
  30. id: import_gpg
  31. uses: hashicorp/ghaction-import-gpg@v2.1.0
  32. env:
  33. # These secrets will need to be configured for the repository:
  34. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  35. PASSPHRASE: ${{ secrets.PASSPHRASE }}
  36. - name: Run GoReleaser
  37. uses: goreleaser/goreleaser-action@v3
  38. with:
  39. args: release --rm-dist
  40. env:
  41. # GitHub sets the GITHUB_TOKEN secret automatically.
  42. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  43. GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}