Skip to content

nice improvements over player/camera movement #23

nice improvements over player/camera movement

nice improvements over player/camera movement #23

Workflow file for this run

name: WASM Build, Test, Deploy
# Largely taken from
# https://github.com/TX-2/TX-2-simulator/blob/main/.github/workflows/deploy-wasm.yml
permissions: {}
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt install -y libasound2-dev libudev-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
# - name: Install wasm-pack
# Use workspace target directory for cargo install's build,
# so that the build of wasm-pack will be cached by rust-cache action.
# run: CARGO_TARGET_DIR=`pwd`/target cargo install wasm-pack
# - name: NPM install (latest)
# run: cd tx2-web && npm install npm@latest
# - name: Run Cargo tests
# run: cargo test --workspace
# - name: NPM (including WASM) Build
# run: cd tx2-web && npm run build
# - name: eslint
# run: cd tx2-web && npm run lint
- name: Install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli
- name: Build WASM file
run: cargo build --release --target wasm32-unknown-unknown
- name: Build Js loader
run: wasm-bindgen --target web --out-dir ./out ./target/wasm32-unknown-unknown/release/pokeclone.wasm --no-typescript
- name: Move a few assets around before upload
run: |
mv assets out/assets
mv out/assets/wasm/index.html out/index.html
# Save wasm build so that we can optionally deploy it without rebuilding
- name: Save wasm dist artifact
uses: actions/upload-artifact@v4
with:
name: pokeclone-wasm
path: out
if-no-files-found: error
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
# Do this only if we are pushing to main, not to pull requests.
# (Or if we're on a special 'pages-alt' branch, so we can experiment with
# deployment before pushing to main.)
#
# Caution: GitHub's parsing is weird around multiline expressions so just don't.
# https://github.community/t/how-to-write-multi-line-condition-in-if/128477
# if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pages-alt') }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: Download wasm dist artifact
uses: actions/download-artifact@v4
with:
name: pokeclone-wasm
path: dist-for-deploy
- name: Deploy to GitHub Pages
# When changing version of this action, remember to update the
# repository settings in github, otherwise the new version may
# not be allowed to run.
#
# We switched from "v4" to
# "df5cc2bfa78282ded844b354faee141f06b41865" on the advice of
# https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions
# (this guards against supply-chain attacks).
uses: crazy-max/ghaction-github-pages@df5cc2bfa78282ded844b354faee141f06b41865
with:
repo: chocorean/pokeclone-demo
target_branch: pages
build_dir: dist-for-deploy
keep_history: false
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GH_POKECLONE_DEMO_TOKEN }}