Build surrealdb.wasm #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build surrealdb.wasm | |
on: | |
workflow_dispatch: | |
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 Node & NPM" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
registry-url: "https://registry.npmjs.org" | |
- 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;npm install | |
- name: "Build & Bundle" | |
run: cd surrealdb.wasm;wasm-pack build --release --target web --out-name index --out-dir ../assets/wasm/surrealdb --no-default-features --features protocol-ws,protocol-http,kv-indxdb,kv-mem,rustls | |
- name: "Install NPM dependencies" | |
run: npm install | |
- name: "Compress wasm file" | |
run: npm run wasm-flate-gzip | |
- name: Git commit compressed wasm file | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add assets/wasm/surrealdb/surrealdb.wasm.gz | |
if [ -n "$(git status --porcelain)" ]; then | |
git commit -m "chore: updated surrealdb.wasm.gz" | |
git push | |
fi |