Skip to content

Commit e8c61c8

Browse files
ci(release): add workflow_dispatch fallback for tag-push event gaps (#109)
Push/tag events have intermittently failed to enqueue runs (merges to main after 2026-08-26T14:55Z created no CI runs), blocking tag-triggered publishes. Adds a manual trigger with a required tag input; the job resolves RELEASE_REF_NAME once, checks out the tag's exact commit, and all tag-derived steps use it instead of GITHUB_REF_NAME (mirrors ci.yml's dispatch-scoped model-data-drift pattern).
1 parent 1d82590 commit e8c61c8

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ on:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
77
- "v[0-9]+.[0-9]+.[0-9]+-*"
8+
# Fallback for when a tag push doesn't enqueue a run (GitHub event-delivery
9+
# gaps). Triggers are workflow-wide in Actions, so the tag input is
10+
# re-derived as RELEASE_REF_NAME (see the `ref` step) and every step below
11+
# uses that instead of GITHUB_REF_NAME; the tag is fetched and checked out
12+
# at its exact commit.
13+
workflow_dispatch:
14+
inputs:
15+
tag:
16+
description: "Release tag, e.g. v0.9.0-next.0 (must exist)"
17+
required: true
18+
type: string
819

920
# Default to no permissions; elevate per-job (least privilege).
1021
permissions: {}
1122

12-
# Never run two publishes for the same ref concurrently.
23+
# Never run two publishes for the same release concurrently (dispatch runs
24+
# carry the branch ref, so key the group on the resolved release ref).
1325
concurrency:
14-
group: release-${{ github.ref }}
26+
group: release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
1527
cancel-in-progress: false
1628

1729
jobs:
@@ -22,7 +34,21 @@ jobs:
2234
contents: write # create the GitHub Release
2335
id-token: write # npm provenance attestation
2436
steps:
37+
- name: Resolve release ref
38+
id: ref
39+
run: |
40+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
41+
echo "RELEASE_REF_NAME=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "RELEASE_REF_NAME=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
44+
fi
45+
2546
- uses: actions/checkout@v7
47+
with:
48+
# Manual runs dispatch from a branch (usually main); check out the
49+
# tag's exact commit so tag and package.json agree.
50+
ref: ${{ steps.ref.outputs.RELEASE_REF_NAME }}
51+
fetch-depth: 0
2652

2753
- name: Set up Node
2854
uses: actions/setup-node@v7
@@ -37,9 +63,10 @@ jobs:
3763
- name: Verify tag matches package.json version
3864
run: |
3965
PKG_VERSION="$(node -p "require('./package.json').version")"
40-
TAG_VERSION="${GITHUB_REF_NAME#v}"
66+
TAG_NAME="${{ steps.ref.outputs.RELEASE_REF_NAME }}"
67+
TAG_VERSION="${TAG_NAME#v}"
4168
if [[ "$PKG_VERSION" != "$TAG_VERSION" ]]; then
42-
echo "::error::git tag $GITHUB_REF_NAME (=$TAG_VERSION) does not match package.json version $PKG_VERSION"
69+
echo "::error::tag $TAG_NAME (=$TAG_VERSION) does not match package.json version $PKG_VERSION"
4370
exit 1
4471
fi
4572
@@ -73,7 +100,8 @@ jobs:
73100
- name: Classify release from tag
74101
id: version
75102
run: |
76-
VERSION="${GITHUB_REF_NAME#v}"
103+
TAG_NAME="${{ steps.ref.outputs.RELEASE_REF_NAME }}"
104+
VERSION="${TAG_NAME#v}"
77105
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
78106
if [[ "$VERSION" == *-* ]]; then
79107
echo "NPM_TAG=next" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)