| 1 | name: Build Playground |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | paths: |
| 8 | - '**.rs' |
| 9 | - 'playground/**' |
| 10 | workflow_dispatch: |
| 11 | |
| 12 | permissions: |
| 13 | contents: write |
| 14 | |
| 15 | jobs: |
| 16 | build: |
| 17 | runs-on: ubuntu-latest |
| 18 | steps: |
| 19 | - uses: actions/checkout@v3 |
| 20 | - uses: actions-rs/toolchain@v1 |
| 21 | with: |
| 22 | toolchain: stable |
| 23 | - name: Install wasm-pack |
| 24 | run: cargo install wasm-pack |
| 25 | - name: Build wasm |
| 26 | run: | |
| 27 | cd playground |
| 28 | wasm-pack build |
| 29 | - uses: actions/setup-node@v3 |
| 30 | with: |
| 31 | node-version: 16 |
| 32 | cache: 'npm' |
| 33 | cache-dependency-path: playground/www/package-lock.json |
| 34 | - name: Build web |
| 35 | run: | |
| 36 | cd playground/www |
| 37 | npm install |
| 38 | npm run build |
| 39 | - name: Publish dist directory |
| 40 | uses: JamesIves/github-pages-deploy-action@v4 |
| 41 | with: |
| 42 | folder: playground/www/dist |