Repository navigation
126 lines (118 loc) · 3.79 KB
/
Copy pathjs.yml
File metadata and controls
126 lines (118 loc) · 3.79 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: js
on:
merge_group:
pull_request:
push:
branches:
- main
tags:
- 'js/v[0-9].[0-9]+.[0-9]+'
- 'js/v[0-9].[0-9]+.[0-9]+-*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
working-directory: ./js
jobs:
build:
runs-on: ubuntu-24.04
env:
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- run: rustup toolchain install stable --profile minimal --target wasm32-wasip1
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- run: npm run build
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: wit-bindgen-wrpc-wasm
path: js/bin/wit-bindgen-wrpc.wasm
if-no-files-found: error
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
cache-dependency-path: js/package-lock.json
- run: npm ci
- run: npm run fmt:check
- run: npm run lint
- run: npm run check
- run: npm test
bindgen:
needs: build
strategy:
matrix:
os:
- ubuntu-24.04
- windows-2025
runs-on: ${{ matrix.os }}
steps:
- run: git config --global core.autocrlf false
working-directory: .
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: wit-bindgen-wrpc-wasm
path: js/bin
- run: node bin/wit-bindgen-wrpc.js js --generate-all --check --out-dir ../examples/web/ui/bindings ../examples/web/wit
- run: node bin/wit-bindgen-wrpc.js js --generate-all --check --out-dir ${{ github.workspace }}/examples/web/ui/bindings ${{ github.workspace }}/examples/web/wit
publish:
name: publish to npm
needs:
- test
- bindgen
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: wit-bindgen-wrpc-wasm
path: js/bin
- name: publish to npm
env:
IS_TAG: ${{ startsWith(github.ref, 'refs/tags/js/v') }}
run: |
pkgver=$(node -p 'require("./package.json").version')
args=(--provenance --ignore-scripts)
if [[ $pkgver == *"-"* ]]; then
echo "version ${pkgver} is a pre-release"
args+=(--tag next)
fi
if [ "$IS_TAG" = "true" ]; then
tagver=${GITHUB_REF_NAME#js/v}
if ! [ "$pkgver" = "$tagver" ]; then
echo "version mismatch, $pkgver (package) != $tagver (tag)"
exit 1
fi
else
args+=(--dry-run)
fi
npm publish "${args[@]}"