[rs] Build and deploy examples in CI

This commit is contained in:
Gabriel Majeri 2020-04-22 19:00:45 +03:00 committed by Josh Groves
parent 94c06b0c9b
commit 31726862c9

39
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Publish
on:
push:
branches:
- master
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Install Rust WASM toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Build the examples
run: cargo build --release --target wasm32-unknown-unknown --examples
- name: Install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli
- name: Generate JS bindings for the examples
run: |
for i in target/wasm32-unknown-unknown/release/examples/*.wasm;
do
wasm-bindgen --no-typescript --out-dir target/generated --web "$i";
done
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: target/generated
TARGET_FOLDER: examples