-
Notifications
You must be signed in to change notification settings - Fork 34
81 lines (65 loc) · 2.09 KB
/
release.yml
File metadata and controls
81 lines (65 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Release
on:
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Ensure release runs on main
if: github.ref_name != 'main'
run: |
echo "Release workflow must be triggered on the main branch."
exit 1
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Verify version sync and export version
id: version
run: |
node -e "
const fs = require('node:fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const jsr = JSON.parse(fs.readFileSync('jsr.json', 'utf8'));
if (pkg.version !== jsr.version) {
throw new Error('package.json and jsr.json versions are not in sync');
}
fs.appendFileSync(process.env.GITHUB_OUTPUT, 'value=' + pkg.version + '\n');
console.log('Version verified:', pkg.version);
"
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Ensure version is unpublished
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
if npm view "@sebastianwessel/quickjs@${VERSION}" version >/dev/null 2>&1; then
echo "Version ${VERSION} is already published on npm."
exit 1
fi
- name: Lint
run: bun run lint
- name: Typecheck
run: bunx tsc --noEmit
- name: Run tests (serial by file)
run: |
set -euo pipefail
for f in $(find src -type f -name '*.test.ts' | sort); do
echo "Running $f"
bun test "$f"
done
- name: Build
run: bun run build
- name: Publish to npm (trusted publishing)
env:
NODE_AUTH_TOKEN: ""
run: npm publish --provenance --access public --ignore-scripts
- name: Publish to JSR
run: npx jsr publish