From 2b667bb6a290f671b0d1a30d522c774807bd8f18 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 25 Jul 2023 02:27:28 -0500 Subject: [PATCH] ci: add deploy workflow + build script --- .github/workflows/deploy.yaml | 28 ++++++++++++++++++++++++++++ build.sh | 10 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/deploy.yaml create mode 100644 build.sh diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..3d74d32 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,28 @@ +name: Github Pages + +on: [push] + +permissions: + contents: write + +jobs: + build-github-pages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 # repo checkout + - uses: mymindstorm/setup-emsdk@v11 # setup emscripten toolchain + # with: + # version: 3.1.35 + - uses: actions-rs/toolchain@v1 # get rust toolchain for wasm + with: + toolchain: stable + target: wasm32-unknown-emscripten + override: true + - name: Rust Cache # cache the rust build artefacts + uses: Swatinem/rust-cache@v1 + - name: Build # build + run: ./build.sh + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: dist \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..53e4853 --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -eux + +cargo build --target=wasm32-unknown-emscripten --release + +mkdir -p dist + +cp target/wasm32-unknown-emscripten/release/rust_sdl2_wasm.wasm dist +cp target/wasm32-unknown-emscripten/release/rust-sdl2-wasm.js dist +cp index.html dist \ No newline at end of file