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 Rust WASM page and Deploy to GitHub Pages | ||
on: | ||
push: | ||
paths: | ||
- 'rust-wasm/**' | ||
pull_request: | ||
paths: | ||
- 'rust-wasm/**' | ||
concurrency: | ||
group: wasm-page-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Rust 1.74.0 | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: '1.74.0' | ||
target: 'wasm32-unknown-unknown' | ||
- name: Build WebAssembly | ||
# run in rust-wasm directory | ||
working-directory: ./rust-wasm | ||
run: | | ||
cargo install wasm-pack | ||
wasm-pack build --target web | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./rust-wasm | ||
exclude_assets: '.github,src/' | ||