Repository navigation
80 lines (76 loc) · 2.78 KB
/
Copy pathruntime.yml
File metadata and controls
80 lines (76 loc) · 2.78 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
# The runtime's npm package, @reactivescript/runtime (runtime/): built from ref/compile/rt-web.ts and rt-server.ts,
# tested against the Solid release it names, with a program the crate compiles.
#
# A release is a version bump merged to main, once the repository variable RELEASES is `on`: a version npm does not
# have is published by trusted publishing (OIDC, no token) and tagged `runtime-v<version>`.
name: runtime
on:
push:
branches: [main]
paths: ["runtime/**", "ref/compile/rt-web.ts", "ref/compile/rt-server.ts", "compiler/**", ".github/workflows/runtime.yml"]
pull_request:
paths: ["runtime/**", "ref/compile/rt-web.ts", "ref/compile/rt-server.ts", "compiler/**", ".github/workflows/runtime.yml"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: compiler
- uses: actions/setup-node@v5
with:
node-version: 22
- name: The compiler's Node-API build (the test compiles a program)
working-directory: compiler
run: |
npm ci
npx napi build --platform --release --features node --manifest-path ./Cargo.toml -- --lib
- name: Build, test and pack
working-directory: runtime
run: |
npm ci
npm run build
npm test
npm pack
- uses: actions/upload-artifact@v4
with:
name: runtime
path: runtime/*.tgz
version:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.RELEASES == 'on'
needs: build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- uses: actions/checkout@v5
- id: v
run: |
v=$(node -p 'require("./runtime/package.json").version')
if [ -z "$(npm view "@reactivescript/runtime@$v" version 2>/dev/null)" ]; then echo "version=$v" >> "$GITHUB_OUTPUT"; fi
publish:
needs: version
if: needs.version.outputs.version != ''
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # trusted publishing: npm takes the job's OIDC token, and adds provenance
contents: write # the tag
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
name: runtime
- uses: actions/setup-node@v5
with:
node-version: 22
registry-url: https://registry.npmjs.org
- run: npm install -g npm@latest # trusted publishing needs npm 11.5.1 or later
- run: npm publish ./*.tgz --access public
- name: Tag
run: git tag "runtime-v$V" && git push origin "runtime-v$V"
env:
V: ${{ needs.version.outputs.version }}