Skip to content

release per mono v2026.2.8 #15

release per mono v2026.2.8

release per mono v2026.2.8 #15

name: Validate and Tag
on:
pull_request:
types: [closed]
branches:
- main
workflow_dispatch: # Allow manual triggering
permissions:
contents: write
jobs:
build:
if: >
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v'))
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Extract and validate version
id: extract-version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
# Manual trigger: read version from VERSION file
if [[ ! -f VERSION ]]; then
echo "::error::VERSION file not found"
exit 1
fi
VERSION="v$(cat VERSION)"
echo "Using version from VERSION file: $VERSION"
else
# PR merge trigger: extract from branch name
VERSION="${GITHUB_HEAD_REF#release/}"
echo "Extracted version from branch: $VERSION"
fi
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Version does not match expected format vX.X.X (got: $VERSION)"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.24.2'
- name: Get
run: go get -v
- name: lint
uses: golangci/golangci-lint-action@v7
with:
args: ./...
version: v2.2.2
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
tag-and-index:
runs-on: ubuntu-latest
needs: build
environment: Production # require manual approval
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create GitHub Release
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
tag_name: ${{ needs.build.outputs.version }}
name: Release ${{ needs.build.outputs.version }}
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.TKHQ_DEPLOY_ACCESS_TOKEN }}
- name: Trigger pkg.go.dev update
run: |
echo "Triggering pkg.go.dev update..."
curl -s "https://sum.golang.org/lookup/github.com/tkhq/go-sdk@${{ needs.build.outputs.version }}"
echo "Release ${{ needs.build.outputs.version }} complete. The package will be available on pkg.go.dev shortly."