Skip to content

Build surrealdb.wasm and js files #11

Build surrealdb.wasm and js files

Build surrealdb.wasm and js files #11

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