Skip to content

Merge pull request #173 from gonzolino/dependabot/go_modules/github.c… #108

Merge pull request #173 from gonzolino/dependabot/go_modules/github.c…

Merge pull request #173 from gonzolino/dependabot/go_modules/github.c… #108

Workflow file for this run

# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: Release
on:
push:
branches:
- main
jobs:
release-please:
name: Release Please
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- id: release-please
uses: google-github-actions/release-please-action@v4.1.1
with:
bump-minor-pre-major: true
package-name: terraform-provider-tado
release-type: go
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
goreleaser:
if: ${{ needs.release-please.outputs.release_created }}
name: GoReleaser
needs: release-please
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6.2.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6.2.1
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
label:
if: ${{ needs.release-please.outputs.release_created }}
name: Label PR
needs: goreleaser
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Get PR number
id: pr
run: |
echo "pr_number=$(gh pr list --state merged --label 'autorelease: tagged' --json number --jq '.[0].number')" >> $GITHUB_OUTPUT
- run: "gh pr edit ${{ steps.pr.outputs.pr_number }} --remove-label 'autorelease: tagged'"
- run: "gh pr edit ${{ steps.pr.outputs.pr_number }} --add-label 'autorelease: published'"