Skip to content

ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.796.4 (#342) #161

ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.796.4 (#342)

ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.796.4 (#342) #161

Workflow file for this run

name: Publish
permissions:
contents: write
"on":
push:
branches:
- main
paths:
- .speakeasy/gen.lock
workflow_dispatch: {}
concurrency:
group: speakeasy-publish
cancel-in-progress: false
jobs:
# Release gate: the full live acceptance suite must pass against the real
# API before anything is published. Uses the same environment secret and
# safety model as acceptance.yaml (dedicated $0-credit test org, tf-acc-*
# namespacing + sweeper, serialized with nightly runs via the shared
# tf-acceptance concurrency group).
acceptance-gate:
runs-on: ubuntu-latest
environment: acceptance-testing
timeout-minutes: 45
concurrency:
group: tf-acceptance
cancel-in-progress: false
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false
- name: Build provider
run: go build ./...
- name: Run acceptance tests
env:
TF_ACC: "1"
OPENROUTER_MANAGEMENT_KEY: ${{ secrets.OPENROUTER_MANAGEMENT_KEY }}
run: go test ./internal/acceptance/... -v -timeout 30m
# Direct GoReleaser release, replacing
# speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml.
# The Speakeasy release action runs inside a Docker container whose image
# does not ship goreleaser, so its terraform path fails deterministically
# with `exec: "goreleaser": executable file not found in $PATH`. This job
# follows the pattern proven by other Speakeasy-generated providers
# (e.g. Kong/terraform-provider-konnect): read the version Speakeasy wrote
# to gen.lock, tag it, and run goreleaser with the repo's .goreleaser.yml.
release:
name: Release Terraform provider
needs: acceptance-gate
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
with:
# Full history + tags: goreleaser needs the tag and previous-tag
# detection to compute the release.
fetch-depth: 0
- name: Resolve release version from gen.lock
id: version
run: |
set -euo pipefail
VERSION=$(grep -m1 'releaseVersion:' .speakeasy/gen.lock | sed 's/.*releaseVersion:[[:space:]]*//')
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+([-+].*)?$'; then
echo "::error::Could not parse releaseVersion from .speakeasy/gen.lock (got: '$VERSION')"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
# Idempotency: re-runs (e.g. after a flaky acceptance gate) must not
# fail on an existing tag or double-publish an existing release.
- name: Check for existing release
id: exists
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
TAG="${{ steps.version.outputs.tag }}"
if gh release view "$TAG" --repo "${{ github.repository }}" > /dev/null 2>&1; then
echo "Release $TAG already exists — nothing to publish"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Create and push tag
if: steps.exists.outputs.skip != 'true'
run: |
set -euo pipefail
TAG="${{ steps.version.outputs.tag }}"
if git rev-parse -q --verify "refs/tags/$TAG" > /dev/null; then
echo "Tag $TAG already exists (previous run failed after tagging)"
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "refs/tags/$TAG"
fi
# Release exactly the tagged tree, even if main moved since.
git checkout "refs/tags/$TAG"
- uses: actions/setup-go@v6
if: steps.exists.outputs.skip != 'true'
with:
go-version-file: go.mod
cache: true
- name: Import GPG key
if: steps.exists.outputs.skip != 'true'
uses: crazy-max/ghaction-import-gpg@v6
id: import_gpg
with:
gpg_private_key: ${{ secrets.TERRAFORM_GPG_SECRET_KEY }}
passphrase: ${{ secrets.TERRAFORM_GPG_PASSPHRASE }}
- name: Run GoReleaser
if: steps.exists.outputs.skip != 'true'
uses: goreleaser/goreleaser-action@v7
with:
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.tag }}