Release #83
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version to use for release - make sure it starts with v' | |
required: true | |
type: string | |
repository_dispatch: | |
types: | |
- release | |
permissions: | |
contents: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'true' | |
token: ${{ secrets.ORG_GITHUB_TOKEN }} | |
- name: Fetch All Tags | |
run: git fetch --force --tags | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Cache Go modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Ensure Changelog | |
run: | | |
if test -f ./.changes/${{ inputs.version }}.md | |
then | |
echo "Skip Changie..." | |
else | |
go install github.com/miniscruff/changie@latest | |
changie batch ${{ inputs.version }} | |
changie merge | |
fi | |
- name: Generate Terraform Docs | |
run: | | |
go get github.com/hashicorp/[email protected] | |
go get github.com/hashicorp/terraform-plugin-docs/internal/[email protected] | |
go generate | |
- name: Commit & Tag Release | |
run: | | |
git config user.name "OpsLevel Bots" | |
git config user.email "[email protected]" | |
if [[ $(git diff --stat) != '' ]]; | |
then | |
git add . | |
git commit -m "Cut Release '${{ inputs.version }}'" | |
git push origin HEAD | |
else | |
echo "Skip commit" | |
fi | |
git tag -f ${{ inputs.version }} -m "Cut Release '${{ inputs.version }}'" | |
git push -f origin refs/tags/${{ inputs.version }} | |
- name: Ensure Release Does Not Exist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release delete ${{ inputs.version }} || true | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Run GoReleaser | |
uses: goreleaser/[email protected] | |
with: | |
args: release --clean --release-notes=./.changes/${{ inputs.version }}.md | |
env: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Report Release To OpsLevel | |
uses: opslevel/[email protected] | |
with: | |
integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }} | |
service: "opslevel_terraform_provider" |