Wasm building #203
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 Wasm | |
run-name: Wasm building | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
pull-requests: read | |
jobs: | |
builds: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [web, nodejs, bundler] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
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 | |
- 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: | | |
* |