# Terraform Provider release workflow. name: Release # This GitHub action creates a release when a tag that matches the pattern # "v*" (e.g. v0.1.0) is created. on: push: tags: - "v*" # Releases need permissions to read and write the repository contents. # GitHub considers creating releases and uploading assets as writing contents. permissions: contents: write jobs: test: uses: ./.github/workflows/test.yml secrets: BINARYLANE_API_TOKEN: ${{ secrets.BINARYLANE_API_TOKEN }} goreleaser: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: # Allow goreleaser to access older tag information. fetch-depth: 0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" cache: true - name: Import GPG key uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 id: import_gpg with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.PASSPHRASE }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 with: args: release --clean env: # GitHub sets the GITHUB_TOKEN secret automatically. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - name: Publish Release if: startsWith(github.ref, 'refs/tags/v') run: gh release edit "${{ github.ref }}" --draft=false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}