From 5671331e7ebe5dece6c890f3f3d5c90a4769bc36 Mon Sep 17 00:00:00 2001 From: Fiona Date: Fri, 7 Aug 2026 04:16:21 -0700 Subject: [PATCH] fix(ci): make a pushed tag actually release again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two things stood between a tag and a release, and both had to be worked around by hand every time. Checkout failed before any job did real work. This workflow is triggered *by* the tag, so the tag is the ref being checked out and is already present — asking for `fetch-tags` on top makes checkout fetch the commit and the tag into the same `refs/tags/*`, which git refuses. That took down every tag-triggered release from v0.0.5 onward; v0.0.5, v0.0.6 and v0.0.7 all went out through the manual workflow instead. `deploy-manual.yml` keeps the flag, and needs it: it runs from a branch, where the tag is not the ref. `yarn release` failed before that, on the machine running it. `lerna version` starts with `git remote update`, which fetches every remote and recurses into their submodules; branches on the upstream fork reference `rum-events-format` commits its own remote does not serve. Nothing in a release reads upstream, so it is now kept out of that update — from the release command itself, so it holds on any clone rather than on whichever machine happened to be configured. --- .github/workflows/deploy-auto.yml | 16 ++++++---------- scripts/cli | 9 +++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy-auto.yml b/.github/workflows/deploy-auto.yml index b1fa323113..0fab47281d 100644 --- a/.github/workflows/deploy-auto.yml +++ b/.github/workflows/deploy-auto.yml @@ -5,6 +5,12 @@ on: tags: - 'v*' # 当推送带有 v 前缀的标签时触发 +# Unlike deploy-manual.yml, no job here asks for `fetch-tags`. This workflow is triggered *by* the +# tag, so the tag is the ref being checked out and is already there — `check-release.js` finds it. +# Asking for it on top makes checkout fetch the commit and the tag into the same `refs/tags/*`, +# which git refuses: "Cannot fetch both and refs/tags/vX to refs/tags/vX". That failure took +# down every tag-triggered release from v0.0.5 onwards. + env: NODE_VERSION: '23.11.1' BUILD_MODE: release @@ -16,8 +22,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-tags: true - name: Setup Node.js uses: actions/setup-node@v4 @@ -66,8 +70,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-tags: true - name: Setup Node.js uses: actions/setup-node@v4 @@ -103,8 +105,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-tags: true - name: Setup Node.js uses: actions/setup-node@v4 @@ -127,8 +127,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-tags: true - name: Prepare notification run: | @@ -157,8 +155,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-tags: true - name: Prepare notification run: | diff --git a/scripts/cli b/scripts/cli index aa7ef8b0f9..f26dfcf211 100755 --- a/scripts/cli +++ b/scripts/cli @@ -63,6 +63,15 @@ cmd_build_json2type () { cmd_release () { [[ `git branch --show-current` != "main" ]] || fail 'please do not release from `main` branch' + + # `lerna version` starts with `git remote update`, which fetches every remote and recurses into + # their submodules. Branches on the upstream fork reference `rum-events-format` commits its own + # remote does not serve, so that fetch fails and takes the release down before anything is + # tagged. Nothing here reads upstream, so keep it out of the update. Idempotent, and a no-op for + # anyone without that remote. + if git remote get-url upstream > /dev/null 2>&1; then + git config remote.upstream.skipDefaultUpdate true + fi # We should publish all packages regardless of if there are changes in each. # --force-publish will skip the `lerna changed` check for changed packages # https://github.com/lerna/lerna/tree/main/libs/commands/version#--force-publish