-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.83 KB
/
deploy.yml
File metadata and controls
58 lines (49 loc) · 1.83 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build and Deploy
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
check-latest: true
- name: Build WASM
run: |
cd wasm-build
go get -u github.com/php-any/origami@main
go mod tidy
GOOS=js GOARCH=wasm go build -o ../public/wasm/origami.wasm .
# Try to locate and copy wasm_exec.js more robustly
GOROOT=$(go env GOROOT)
if [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
cp "$GOROOT/misc/wasm/wasm_exec.js" ../public/wasm_exec.js
elif [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
cp "$GOROOT/lib/wasm/wasm_exec.js" ../public/wasm_exec.js
else
echo "Warning: wasm_exec.js not found in GOROOT. Downloading from CDN as fallback."
curl -L https://cdn.jsdelivr.net/gh/golang/go@master/misc/wasm/wasm_exec.js -o ../public/wasm_exec.js
fi
cd ..
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install Dependencies
run: npm install
- name: Build Frontend
run: npm run build
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
branch: gh-pages