Skip to content

add wasm

add wasm #4

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
env:
NODE_VERSION: '18'
RUST_VERSION: 'stable'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Rust WASM
run: wasm-pack build --target web
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: './www/package-lock.json'
- name: Install dependencies
run: |
cd www
npm ci
- name: Build project
run: |
cd www
npm run build
env:
VITE_MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./www/dist
commit_message: ${{ github.event.head_commit.message }}
force_orphan: true
deploy:
needs: build-and-deploy
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4