Skip to content

Wasm building

Wasm building #218

Workflow file for this run

name: Build Wasm
run-name: Wasm building
on: [push, pull_request]
permissions:
contents: write
pull-requests: read
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
builds:
strategy:
fail-fast: false
matrix:
target: [web, nodejs, bundler]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install NodeJs
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
continue-on-error: true
- name: Install wasm-pack
uses: jetli/[email protected]
- name: Build
run: wasm-pack build --release --target ${{ matrix.target }} -- --features ffi_wasm,module
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Lebai_WASM_SDK_${{ matrix.target }}
path: ./pkg
- name: Release
if: ${{ contains(github.ref, 'tags/v') && matrix.target == 'bundler' }}
continue-on-error: true
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
wasm-pack publish
release:
if: ${{ contains(github.ref, 'tags/v') }}
needs: [builds]
strategy:
fail-fast: false
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v3
- name: Zip Artifact
run: for dir in `ls`; do zip -r ${dir}.zip ${dir}; done
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: false
prerelease: false
files: |
*