render in gh-pages #10
This file contains hidden or 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: Deploy WASM to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Install wasm-pack | |
| run: | | |
| curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | bash | |
| - name: Build WASM | |
| run: wasm-pack build --target bundler --out-dir pkg --no-pack --no-opt | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20.x' | |
| - name: Install npm dependencies and build | |
| run: | | |
| cp ../wasm/* . | |
| npm pack | |
| npm install | |
| working-directory: ./pkg | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./pkg | |
| keep_files: false |