diff --git a/.github/workflows/deploy wasm to gh-pages.yml b/.github/workflows/deploy wasm to gh-pages.yml new file mode 100644 index 0000000..1a5bb6f --- /dev/null +++ b/.github/workflows/deploy wasm to gh-pages.yml @@ -0,0 +1,34 @@ +on: push +name: Build and deploy web page with WASM version +jobs: + build: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Checkout project + uses: actions/checkout@v3 + - name: Setup - Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + target: wasm32-unknown-unknown + override: true + - name: Setup - wasm-bindgen + uses: jetli/wasm-bindgen-action@v0.2.0 + - name: Build, bind WASM + run: | + cargo build --release --target wasm32-unknown-unknown + wasm-bindgen target/wasm32-unknown-unknown/release/rust-rl.wasm --out-dir wasm --no-modules --no-typescript + - name: Publish web\ to gh-pages + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + cd wasm/ + git init --initial-branch=master + git config user.name "GitHub Actions" + git config user.email "github-actions-bot@users.noreply.github.com" + git add . + + git commit -m "Deploy ${GITHUB_REPOSITORY} to ${GITHUB_REPOSITORY}:gh-pages" + git push --force "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" master:gh-pages + echo "Deploy complete"