File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy WASM
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ deploy :
9+ runs-on : ubuntu-latest
10+ env :
11+ TARGET_DIR : target
12+ steps :
13+ - uses : actions/checkout@v6
14+
15+ - uses : actions/setup-go@v6
16+ with :
17+ go-version-file : go.mod
18+
19+ - name : Build WASM
20+ run : GOOS=js GOARCH=wasm go build -o river-raid.wasm .
21+
22+ - name : Copy wasm_exec.js
23+ run : cp $(go env GOROOT)/lib/wasm/wasm_exec.js .
24+
25+ - name : Checkout target repo
26+ uses : actions/checkout@v6
27+ with :
28+ repository : river-raid/river-raid.github.io
29+ token : ${{ secrets.DEPLOY_TOKEN }}
30+ path : ${{ env.TARGET_DIR }}
31+
32+ - name : Copy artifacts
33+ run : |
34+ cp river-raid.wasm ${{ env.TARGET_DIR }}/
35+ cp wasm_exec.js ${{ env.TARGET_DIR }}/
36+
37+ - name : Commit and push
38+ working-directory : ${{ env.TARGET_DIR }}
39+ run : |
40+ git config user.name "github-actions[bot]"
41+ git config user.email "github-actions[bot]@users.noreply.github.com"
42+ git add river-raid.wasm wasm_exec.js
43+ git diff --cached --quiet || (git commit -m "Deploy WASM build from ${GITHUB_SHA::7}" && git push)
You can’t perform that action at this time.
0 commit comments