@@ -228,12 +228,26 @@ jobs:
228228 mv pkg/bin/*.exe pkg/bin/gnd.exe
229229 fi
230230
231- - name : Create package.json
231+ - name : Determine version and npm tag
232+ id : version
232233 shell : bash
233234 run : |
234235 VERSION="${{ github.ref_name }}"
235236 VERSION="${VERSION#v}"
237+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
238+ # Prerelease versions (e.g. 0.42.2-dev.1) need an explicit --tag
239+ if [[ "$VERSION" == *-* ]]; then
240+ # Extract prerelease identifier (e.g. "dev" from "0.42.2-dev.1")
241+ PRE="${VERSION#*-}"
242+ TAG="${PRE%%.*}"
243+ echo "tag=${TAG}" >> $GITHUB_OUTPUT
244+ else
245+ echo "tag=latest" >> $GITHUB_OUTPUT
246+ fi
236247
248+ - name : Create package.json
249+ shell : bash
250+ run : |
237251 if [ "${{ matrix.os_field }}" = "win32" ]; then
238252 BIN_PATH="./bin/gnd.exe"
239253 else
@@ -243,7 +257,7 @@ jobs:
243257 cat > pkg/package.json << EOF
244258 {
245259 "name": "@graphprotocol/gnd-${{ matrix.platform }}",
246- "version": "${VERSION }",
260+ "version": "${{ steps.version.outputs.version } }",
247261 "description": "gnd binary for ${{ matrix.platform }}",
248262 "os": ["${{ matrix.os_field }}"],
249263 "cpu": ["${{ matrix.cpu_field }}"],
@@ -263,7 +277,7 @@ jobs:
263277 EOF
264278
265279 - name : Publish
266- run : npm publish --provenance --access public ${{ inputs.dry_run && '--dry-run' || '' }}
280+ run : npm publish --provenance --access public --tag ${{ steps.version.outputs.tag }} ${{ inputs.dry_run && '--dry-run' || '' }}
267281 working-directory : pkg
268282
269283 publish-npm-wrapper :
@@ -281,11 +295,25 @@ jobs:
281295 with :
282296 node-version : 24
283297
284- - name : Create wrapper package
298+ - name : Determine version and npm tag
299+ id : version
285300 shell : bash
286301 run : |
287302 VERSION="${{ github.ref_name }}"
288303 VERSION="${VERSION#v}"
304+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
305+ if [[ "$VERSION" == *-* ]]; then
306+ PRE="${VERSION#*-}"
307+ TAG="${PRE%%.*}"
308+ echo "tag=${TAG}" >> $GITHUB_OUTPUT
309+ else
310+ echo "tag=latest" >> $GITHUB_OUTPUT
311+ fi
312+
313+ - name : Create wrapper package
314+ shell : bash
315+ run : |
316+ VERSION="${{ steps.version.outputs.version }}"
289317
290318 mkdir -p pkg/bin
291319 cp gnd/npm/bin/gnd.js pkg/bin/gnd.js
@@ -318,5 +346,5 @@ jobs:
318346 EOF
319347
320348 - name : Publish
321- run : npm publish --provenance --access public ${{ inputs.dry_run && '--dry-run' || '' }}
349+ run : npm publish --provenance --access public --tag ${{ steps.version.outputs.tag }} ${{ inputs.dry_run && '--dry-run' || '' }}
322350 working-directory : pkg
0 commit comments