@@ -2,11 +2,6 @@ name: Release
22
33on :
44 workflow_dispatch :
5- inputs :
6- version :
7- description : " Version to release (must match package.json and jsr.json)"
8- required : true
9- type : string
105
116permissions :
127 contents : read
@@ -27,29 +22,33 @@ jobs:
2722 uses : actions/setup-node@v4
2823 with :
2924 node-version : 22
30- registry-url : " https://registry.npmjs.org"
3125
32- - name : Verify version sync
33- env :
34- INPUT_VERSION : ${{ inputs.version }}
26+ - name : Verify version sync and export version
27+ id : version
3528 run : |
3629 node -e "
3730 const fs = require('node:fs');
3831 const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
3932 const jsr = JSON.parse(fs.readFileSync('jsr.json', 'utf8'));
40- const expected = process.env.INPUT_VERSION;
4133 if (pkg.version !== jsr.version) {
4234 throw new Error('package.json and jsr.json versions are not in sync');
4335 }
44- if (pkg.version !== expected) {
45- throw new Error('workflow input version does not match package.json/jsr.json version');
46- }
47- console.log('Version verified:', expected);
36+ fs.appendFileSync(process.env.GITHUB_OUTPUT, 'value=' + pkg.version + '\n');
37+ console.log('Version verified:', pkg.version);
4838 "
4939
5040 - name : Install dependencies
5141 run : bun install --frozen-lockfile
5242
43+ - name : Ensure version is unpublished
44+ env :
45+ VERSION : ${{ steps.version.outputs.value }}
46+ run : |
47+ if npm view "@sebastianwessel/quickjs@${VERSION}" version >/dev/null 2>&1; then
48+ echo "Version ${VERSION} is already published on npm."
49+ exit 1
50+ fi
51+
5352 - name : Lint
5453 run : bun run lint
5554
5857
5958 - name : Run tests (serial by file)
6059 run : |
61- set -e
62- for f in $(rg --files src | rg '\ .test\ .ts$ ' | sort); do
60+ set -euo pipefail
61+ for f in $(find src -type f -name '* .test.ts' | sort); do
6362 echo "Running $f"
6463 bun test "$f"
6564 done
6867 run : bun run build
6968
7069 - name : Publish to npm (trusted publishing)
70+ env :
71+ NODE_AUTH_TOKEN : " "
7172 run : npm publish --provenance --access public --ignore-scripts
7273
7374 - name : Publish to JSR
0 commit comments