From 0c8b59d5c13d961ef7bd10307312ca97bb479819 Mon Sep 17 00:00:00 2001 From: Utkarsh Patel Date: Thu, 28 May 2026 17:51:03 +0530 Subject: [PATCH] fix(ci): correct DIST_BRANCH on release events for stream-dist deploy On a release event, GITHUB_REF is refs/tags/, so the previous ${GITHUB_REF#refs/heads/} stripping left DIST_BRANCH equal to the literal 'refs/tags/'. The downstream 'git checkout -B "$DIST_BRANCH"' then created a branch literally named 'refs/tags/' alongside the new tag of the same short name, making 'git push --tags origin refs/tags/' ambiguous: error: src refspec refs/tags/ matches more than one Resolve by branching on github.event_name: derive DIST_BRANCH from the release's target_commitish (typically master) on release events, and from refs/heads/ on push events. Also tighten the release push to explicitly push just the target branch and the new tag instead of relying on --tags, which would push every local tag. This bug was latent from the September 2024 workflow rewrite and only became observable after PR #1853 re-added the release trigger, since v4.2.0-rc.1 was the first release event to exercise this code path. Verified failure on: - runs/26573649458 (v4.2.0) - runs/26493589602 (v4.2.0-rc.1) --- .github/workflows/deploy-to-stream-dist.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-to-stream-dist.yml b/.github/workflows/deploy-to-stream-dist.yml index 71796c50c..45514315f 100644 --- a/.github/workflows/deploy-to-stream-dist.yml +++ b/.github/workflows/deploy-to-stream-dist.yml @@ -64,10 +64,21 @@ jobs: WORKING_BRANCH="$(git rev-parse --abbrev-ref HEAD)" SRC_DIR="$ROOT_DIR/source" DIST_DIR="$ROOT_DIR/dist" - DIST_BRANCH="${GITHUB_REF#refs/heads/}" - DIST_TAG="${GITHUB_REF#refs/tags/}" COMMIT_MESSAGE="$(git log -1 --oneline)" + if [ "${{ github.event_name }}" = "release" ]; then + # On a release event, GITHUB_REF is refs/tags/. Push the dist + # commit to the branch the release targets (e.g. master) and create + # the tag on top of it. + DIST_BRANCH="${{ github.event.release.target_commitish }}" + DIST_TAG="${GITHUB_REF#refs/tags/}" + else + # On a push event, GITHUB_REF is refs/heads/. Mirror the + # branch to dist without tagging. + DIST_BRANCH="${GITHUB_REF#refs/heads/}" + DIST_TAG="" + fi + echo "ROOT_DIR=$ROOT_DIR" >> $GITHUB_ENV echo "WORKING_BRANCH=$WORKING_BRANCH" >> $GITHUB_ENV echo "SRC_DIR=$SRC_DIR" >> $GITHUB_ENV @@ -121,7 +132,7 @@ jobs: if [ "${{ github.event_name }}" = "release" ]; then echo "Tagging a release: $DIST_TAG" git tag --force "$DIST_TAG" - git push --force --tags origin "$DIST_BRANCH" + git push --force origin "$DIST_BRANCH" "refs/tags/$DIST_TAG" else git push --force origin "$DIST_BRANCH" fi