-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (53 loc) · 1.67 KB
/
typescript-ci.yml
File metadata and controls
56 lines (53 loc) · 1.67 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
name: TypeScript / WASM CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
jobs:
wasm-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# wasm-pack internally passes --artifact-dir to cargo, which requires nightly
- uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build WASM (bundler target)
run: wasm-pack build --target bundler --features wasm
- name: Set npm package name
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('pkg/package.json', 'utf8'));
pkg.name = '@promptexecution/tomllm';
fs.writeFileSync('pkg/package.json', JSON.stringify(pkg, null, 2));
"
- name: Upload WASM artifact
uses: actions/upload-artifact@v4
with:
name: wasm-pkg
path: pkg/
publish-npm:
name: Publish to npm
needs: wasm-build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: wasm-pkg
path: pkg/
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Publish
# wasm-pack generates pkg/package.json with @promptexecution/tomllm name
run: npm publish --access public
working-directory: pkg/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}