Skip to content

Merge pull request #142 from controlplane-com/prepare-1-1-41 #76

Merge pull request #142 from controlplane-com/prepare-1-1-41

Merge pull request #142 from controlplane-com/prepare-1-1-41 #76

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.
#
# https://developer.hashicorp.com/terraform/registry/providers/publishing
# https://github.com/hashicorp/terraform-provider-scaffolding-framework/blob/main/.github/workflows/release.yml
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-and-test:
runs-on: ubuntu-latest
environment: acc-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Get dependencies
run: go get -v -t -d ./...
- name: Build
run: go build -v ./...
- name: Run Tests
run: go test -v ./... -timeout 30m
env:
TF_ACC: true
CPLN_ORG: terraform-test-org
CPLN_ENDPOINT: https://api.test.cpln.io
CPLN_TOKEN: "${{secrets.CPLN_TOKEN}}"
goreleaser:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
# - name: Unshallow
# run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: "go.mod"
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}