Merge pull request #31 from hatoo/bevy016 #46
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
| on: | |
| push: | |
| branches: | |
| - master | |
| name: Deploy | |
| jobs: | |
| build: | |
| name: Deploy wasm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo install wasm-bindgen-cli --locked --version 0.2.100 | |
| - run: cargo install wasm-opt --locked --version 0.116.1 | |
| - name: Build | |
| run: cargo build --profile web --target wasm32-unknown-unknown | |
| - name: wasm-bindgen | |
| run: wasm-bindgen --no-typescript --target web --out-dir ./docs/ --out-name "tempo-trainer" ./target/wasm32-unknown-unknown/web/tempo-trainer.wasm | |
| - run: wasm-opt -Oz ./docs/tempo-trainer_bg.wasm -o output.wasm && mv output.wasm ./docs/tempo-trainer_bg.wasm | |
| - run: cp -r assets docs/ | |
| - name: Upload static files as artifact | |
| id: deployment | |
| uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action | |
| with: | |
| path: docs/ | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write # to deploy to Pages | |
| id-token: write # to verify the deployment originates from an appropriate source | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |