-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (33 loc) · 1.25 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# NB. Set Actions permissions / Workflow permissions to "Read and write" for
# publishing the gh-pages branch to work.
on: push
name: Build and deploy web page with WASM version
jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Build and deploy WASM binary
run: |
cargo build --target=wasm32-unknown-unknown --profile=release-lto
cp target/wasm32-unknown-unknown/release-lto/gametemplate.wasm web/
- name: Publish static website
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
cd web/
git init --initial-branch=master
git config user.name "GitHub Actions"
git config user.email "[email protected]"
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"