release.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
  18. with:
  19. # Allow goreleaser to access older tag information.
  20. fetch-depth: 0
  21. - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
  22. with:
  23. go-version-file: 'go.mod'
  24. cache: true
  25. - name: Import GPG key
  26. uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
  27. id: import_gpg
  28. with:
  29. gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
  30. passphrase: ${{ secrets.PASSPHRASE }}
  31. - name: Run GoReleaser
  32. uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
  33. with:
  34. args: release --clean
  35. env:
  36. # GitHub sets the GITHUB_TOKEN secret automatically.
  37. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  38. GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}