From 44efc3f9b6b93f3c8f5eb80df2bc2d93f5e424d9 Mon Sep 17 00:00:00 2001 From: psteinroe Date: Tue, 11 Aug 2026 09:44:51 +0000 Subject: [PATCH] ci(release): allow explicit version tags --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d99ffd2..e8c052b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,11 @@ name: Release on: workflow_dispatch: + inputs: + version: + description: Release tag (for example, 0.2.0). Leave blank to calculate it from commits. + required: false + type: string permissions: contents: write @@ -31,7 +36,26 @@ jobs: - name: Set version name id: set_version - run: echo "version=$(git cliff --bumped-version)" >> "$GITHUB_OUTPUT" + env: + REQUESTED_VERSION: ${{ inputs.version }} + run: | + if [[ -n "$REQUESTED_VERSION" ]]; then + if [[ ! "$REQUESTED_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then + echo "Invalid release version: $REQUESTED_VERSION" + exit 1 + fi + + if git rev-parse --verify --quiet "refs/tags/$REQUESTED_VERSION"; then + echo "Release tag already exists: $REQUESTED_VERSION" + exit 1 + fi + + VERSION="$REQUESTED_VERSION" + else + VERSION="$(git cliff --bumped-version)" + fi + + echo "version=$VERSION" >> "$GITHUB_OUTPUT" test: name: Test Release Build @@ -91,7 +115,7 @@ jobs: id: changelog with: config: cliff.toml - args: --bump --unreleased + args: --tag ${{ needs.extract_version.outputs.version }} --unreleased env: GITHUB_REPO: ${{ github.repository }}