Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
branches: [main]
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g. 2.1.0, without v prefix). Used to retry a failed stable release.'
required: true
type: string

concurrency:
group: publish
Expand All @@ -17,7 +23,7 @@ jobs:
name: Preflight checks
runs-on: ubuntu-latest
# Skip dev publish when the push is a stable release version bump
if: "${{ github.event_name == 'release' || !startsWith(github.event.head_commit.message, 'chore: release v') }}"
if: "${{ github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'chore: release v') }}"
permissions:
contents: read
steps:
Expand Down Expand Up @@ -49,6 +55,10 @@ jobs:
VERSION="${TAG#v}"
NPM_TAG="latest"
echo "Stable release: $VERSION (from tag $TAG)"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
NPM_TAG="latest"
echo "Stable release (manual retry): $VERSION"
Comment on lines +58 to +61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No validation on inputs.version format - could cause issues if user enters version with "v" prefix or invalid semver

Suggested change
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
NPM_TAG="latest"
echo "Stable release (manual retry): $VERSION"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
# Validate semver format (no 'v' prefix)
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid version format: $VERSION. Expected format: X.Y.Z (e.g., 2.1.0)"
exit 1
fi
NPM_TAG="latest"
echo "Stable release (manual retry): $VERSION"

else
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
NEXT_PATCH=$((PATCH + 1))
Expand Down Expand Up @@ -228,13 +238,13 @@ jobs:
# ── Stable-only: version bump PR and tag ──

- name: Configure git
if: github.event_name == 'release'
if: github.event_name != 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Push version bump via PR
if: github.event_name == 'release'
if: github.event_name != 'push'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.compute-version.outputs.version }}
Expand Down
Loading