diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5c1ae08..25388db 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,10 @@ on: branches: ["main"] name: Build and deploy on push + +env: + RUST_CHANNEL: stable + jobs: build: name: Deploy website @@ -13,9 +17,16 @@ jobs: with: node-version: '16' - - name: Install npm + - name: Install asteroids deps uses: actions/setup-node@v2 + - name: Install city-game deps + run: | + rustup update --no-self-update ${{ env.RUST_CHANNEL }} + rustup default ${{ env.RUST_CHANNEL }} + rustup target install wasm32-unknown-unknown + cargo install wasm-bindgen-cli + - name: Build website run: ./scripts/build.sh env: diff --git a/content/projects/the_merp_experiment.md b/content/projects/the_merp_experiment.md new file mode 100644 index 0000000..7d31659 --- /dev/null +++ b/content/projects/the_merp_experiment.md @@ -0,0 +1,7 @@ ++++ +title = "The Merp Experiment" +description = "Game" +weight = 1 ++++ + +[Play here](/the-merp-experiment/). diff --git a/scripts/build-subprojects.sh b/scripts/build-subprojects.sh index 4dda592..bf9b21c 100755 --- a/scripts/build-subprojects.sh +++ b/scripts/build-subprojects.sh @@ -1,15 +1,46 @@ #!/usr/bin/env bash -set -e +set -ex HERE="$(dirname "${BASH_SOURCE[0]}")" cd "$HERE" REPO_DIR="$(git rev-parse --show-toplevel)" -ASTEROIDS="$(mktemp -d -t asteroids-3d.XXX)" -echo "Building subproject [directory=$ASTEROIDS]" -git clone https://github.com/elihunter173/asteroids-3d.git "$ASTEROIDS" -cd "$ASTEROIDS" +subproject() { + proj="$1" + dir="$(mktemp -d -t "$proj".XXX)" + echo "Building subproject [directory=$dir]" + git clone "https://github.com/elihunter173/$proj.git" "$dir" + cd "$dir" +} + +subproject asteroids-3d npm install --production npm run build -cp -r "$ASTEROIDS/dist" "$REPO_DIR/static/asteroids" +cp -r ./dist "$REPO_DIR/static/asteroids" + +eval `ssh-agent -s` +ssh-add - <<< '${{ secrets.CITY_GAME_PRIVATE_DEPLOY_KEY }}' +subproject city-game +cargo build --release --target wasm32-unknown-unknown +wasm-bindgen --no-typescript --target web \ + --out-dir ./out/ \ + --out-name "game" \ + ./target/wasm32-unknown-unknown/web/game.wasm +cat << EOF > ./out/index.html + + + + + + +EOF +cp -r ./assets ./out/. +cp -r ./out "$REPO_DIR/static/the-merp-experiment"