Utilise composite workflows.

This commit is contained in:
2025-12-14 19:40:55 +00:00
parent c489e4506c
commit f01c18353f
8 changed files with 548 additions and 61 deletions
+27
View File
@@ -0,0 +1,27 @@
name: "Go Test"
description: "Run Go tests with race detection"
inputs:
go-version:
description: "Go version to use"
required: false
default: ">=1.24"
working-directory:
description: "Working directory"
required: false
default: "."
runs:
using: "composite"
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
- name: Run tests
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
CGO_ENABLED: 1
run: go test -race -v ./...
+68
View File
@@ -0,0 +1,68 @@
name: "GoReleaser"
description: "Run GoReleaser with optional split/merge for CGO builds"
inputs:
version-tag:
description: "Version tag to release"
required: true
mode:
description: "Mode: 'full' (single runner), 'split' (matrix build), 'merge' (combine split builds)"
required: false
default: "full"
cgo-enabled:
description: "Enable CGO"
required: false
default: "0"
github-token:
description: "GitHub token"
required: true
homebrew-tap-token:
description: "Homebrew tap token (optional)"
required: false
default: ""
runs:
using: "composite"
steps:
- name: Create tag
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a ${{ inputs.version-tag }} -m "Release ${{ inputs.version-tag }}" || true
if [[ "${{ inputs.mode }}" != "split" ]]; then
git push origin ${{ inputs.version-tag }} || true
fi
- name: Run GoReleaser (full)
if: inputs.mode == 'full'
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
HOMEBREW_TAP_TOKEN: ${{ inputs.homebrew-tap-token }}
CGO_ENABLED: ${{ inputs.cgo-enabled }}
- name: Run GoReleaser (split)
if: inputs.mode == 'split'
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --split
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
CGO_ENABLED: ${{ inputs.cgo-enabled }}
- name: Run GoReleaser (merge)
if: inputs.mode == 'merge'
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: continue --merge
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
+29
View File
@@ -0,0 +1,29 @@
name: "Node.js Build"
description: "Setup Node.js and run build script"
inputs:
node-version:
description: "Node.js version to use"
required: false
default: "20"
build-script:
description: "Build script to run"
required: true
cache-dependency-path:
description: "Path to package-lock.json for caching"
required: false
default: ""
runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: "npm"
cache-dependency-path: ${{ inputs.cache-dependency-path }}
- name: Build frontend
shell: bash
run: ${{ inputs.build-script }}
@@ -0,0 +1,36 @@
name: "Rolling Release"
description: "Create or update a rolling release tag"
inputs:
tag:
description: "Rolling release tag (e.g., 'v1')"
required: true
version-tag:
description: "Current version tag this points to"
required: true
github-token:
description: "GitHub token"
required: true
runs:
using: "composite"
steps:
- name: Update rolling release tag
shell: bash
run: |
git tag -f ${{ inputs.tag }}
git push origin ${{ inputs.tag }} --force
- name: Update or create rolling release
uses: ncipollo/release-action@v1
with:
name: ${{ inputs.tag }} - ${{ inputs.version-tag }}
token: ${{ inputs.github-token }}
tag: ${{ inputs.tag }}
prerelease: false
allowUpdates: true
makeLatest: false
body: |
Rolling release pointing to version ${{ inputs.version-tag }}.
Use `@${{ inputs.tag }}` in your GitHub Actions workflows for automatic updates.
+35
View File
@@ -0,0 +1,35 @@
name: "Semantic Version"
description: "Calculate semantic version using semver-generator"
inputs:
config-file:
description: "Path to semver config file"
required: false
default: "semver.yaml"
outputs:
version:
description: "The calculated version (without v prefix)"
value: ${{ steps.format.outputs.version }}
version_tag:
description: "The version tag (with v prefix)"
value: ${{ steps.format.outputs.version_tag }}
runs:
using: "composite"
steps:
- name: Calculate version
id: semver
uses: lukaszraczylo/semver-generator@v1
with:
config_file: ${{ inputs.config-file }}
repository_local: true
- name: Format version
id: format
shell: bash
run: |
VERSION="${{ steps.semver.outputs.semantic_version }}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT
echo "Version: v${VERSION}"