Skip to content

Commit c715143

Browse files
ci: fix stable release publishing wrong npm versions
Stable releases published npm packages as "<old>-<new>" (e.g. 2.9.4-2.10.0) and pointed the 'latest' dist-tag at them. Two causes: - release.yml passed prerel_name for stable releases, so npm:configure_prerelease appended the tag to the package version. That suffix is only meaningful for nightlies. - build.yml checked out the ref the workflow was dispatched on rather than the tag, so it built the tree from *before* create-tag's version bump commit. release-tag-ruby_wasm-gem already passed an explicit ref, which is why the gems carried the right version while npm did not. Add a 'ref' input to build.yml and thread it through every checkout, and drop prerel_name from the stable path so the bumped version publishes as-is. ci:publish took the tag from prerel_name, falling back to GITHUB_REF_NAME. With prerel_name gone that fallback yields 'main' on a workflow_dispatch, so add a separate 'release_tag' input for it. Affected releases: 2.9.0, 2.9.4 and 2.10.0 published as 2.8.1-2.9.0, 2.9.3-2.9.4 and 2.9.4-2.10.0. The last clean stable npm version is 2.8.1.
1 parent f1c909b commit c715143

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ on:
1414
default: false
1515
prerel_name:
1616
type: string
17-
description: "Pre-release name to be released"
17+
description: "Pre-release suffix appended to npm package versions (nightly only)"
18+
default: ""
19+
ref:
20+
type: string
21+
description: "Git ref to build. Defaults to the triggering ref."
22+
default: ""
23+
release_tag:
24+
type: string
25+
description: "Tag name to publish under. Defaults to prerel_name, then the triggering ref name."
1826
default: ""
1927

2028
jobs:
@@ -47,6 +55,8 @@ jobs:
4755
runs-on: ubuntu-24.04
4856
steps:
4957
- uses: actions/checkout@v6
58+
with:
59+
ref: ${{ inputs.ref }}
5060
- uses: docker/setup-buildx-action@v3
5161
- uses: docker/login-action@v3
5262
with:
@@ -70,6 +80,8 @@ jobs:
7080
entries: ${{ steps.set-matrix.outputs.entries }}
7181
steps:
7282
- uses: actions/checkout@v6
83+
with:
84+
ref: ${{ inputs.ref }}
7385
- uses: ruby/setup-ruby@v1
7486
with:
7587
ruby-version: "3.4.1"
@@ -98,6 +110,7 @@ jobs:
98110
steps:
99111
- uses: actions/checkout@v6
100112
with:
113+
ref: ${{ inputs.ref }}
101114
submodules: true
102115
- uses: actions/download-artifact@v8
103116
with:
@@ -164,6 +177,8 @@ jobs:
164177
contents: write
165178
steps:
166179
- uses: actions/checkout@v6
180+
with:
181+
ref: ${{ inputs.ref }}
167182
- uses: actions/download-artifact@v8
168183
with:
169184
name: build-manifest
@@ -179,7 +194,7 @@ jobs:
179194
ruby-version: "3.4.1"
180195
bundler-cache: true
181196
- run: ./bin/setup
182-
- run: echo "PREREL_NAME=${{ inputs.prerel_name }}" >> $GITHUB_ENV
183-
- run: bundle exec rake "ci:publish[${PREREL_NAME:-$GITHUB_REF_NAME}]"
197+
- run: echo "RELEASE_TAG=${{ inputs.release_tag || inputs.prerel_name }}" >> $GITHUB_ENV
198+
- run: bundle exec rake "ci:publish[${RELEASE_TAG:-$GITHUB_REF_NAME}]"
184199
env:
185200
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/release.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
uses: ./.github/workflows/build.yml
6363
with:
6464
publish: true
65+
ref: ${{ needs.create-tag.outputs.tag-name }}
6566
prerel_name: ${{ needs.create-tag.outputs.tag-name }}
6667
secrets: inherit
6768

@@ -77,7 +78,11 @@ jobs:
7778
uses: ./.github/workflows/build.yml
7879
with:
7980
publish: true
80-
prerel_name: ${{ needs.create-tag.outputs.tag-name || github.ref_name }}
81+
# Stable releases publish the bumped version as-is, so no prerel_name here.
82+
# The bump commit is created by create-tag, so build from the tag, not the
83+
# ref the workflow was dispatched on.
84+
ref: ${{ needs.create-tag.outputs.tag-name || github.ref_name }}
85+
release_tag: ${{ needs.create-tag.outputs.tag-name || github.ref_name }}
8186
secrets: inherit
8287

8388
release-tag-ruby_wasm-gem:

0 commit comments

Comments
 (0)