-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.8 KB
/
build-wasm-js.yaml
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
name: Build surrealdb.wasm and js files
on:
workflow_dispatch:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout own repo
uses: actions/checkout@v4
- name: Checkout surrealdb.wasm repo (latest tag)
run: |
git clone https://github.com/surrealdb/surrealdb.wasm.git
cd surrealdb.wasm;export LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git checkout $LATEST_TAG
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install surrealdb.wasm NPM dependencies
run: cd surrealdb.wasm;pnpm install
- name: Build
run: |
cd surrealdb.wasm
make build
cp ./dist/embedded/esm.bundled.js ../assets/wasm/surrealdb
cp ./dist/embedded/index_bg.wasm ../assets/wasm/surrealdb
- name: "Install NPM dependencies"
run: pnpm install
#- name: "Minify and compress JavaScript files"
# run: pnpm run package
- name: "Compress wasm file"
run: pnpm run compress-wasm
- name: Git commit compressed surrealdb_wasm assets
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add -f assets/wasm/surrealdb/surrealdb_wasm.*
git add assets/wasm/surrealdb/index.js
git add assets/wasm/surrealdb/index_bg.wasm
git add assets/wasm/surrealdb/surrealdb.wasm.gz
if [ -n "$(git status --porcelain)" ]; then
git commit -m "chore: updated assets/wasm/surrealdb"
git push
fi