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@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
  18. with:
  19. # Allow goreleaser to access older tag information.
  20. fetch-depth: 0
  21. - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
  22. with:
  23. go-version-file: 'go.mod'
  24. cache: true
  25. - name: Import GPG key
  26. uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.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@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.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 }}