-
-
Notifications
You must be signed in to change notification settings - Fork 205
59 lines (49 loc) · 1.71 KB
/
wasm.yml
File metadata and controls
59 lines (49 loc) · 1.71 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
59
name: Build Intro WASM and Deploy to GitHub Pages
on:
pull_request:
release:
types: [published]
push:
branches: [main, develop]
tags: ['**']
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v16
with:
version: 'latest'
- name: Install Ninja
run: sudo apt-get install -y ninja-build
- name: Configure CMake
run: emcmake cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: Build all WASM targets
run: emmake cmake --build build --target web-dist
- name: Prepare deployment
run: |
# web-dist target already created build/web-dist/
# Just copy it to dist/ for GitHub Pages action
cp -r build/web-dist dist
- name: Determine deploy path
id: deploy-path
if: github.event_name != 'pull_request' && github.event_name != 'release'
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "path=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
elif [[ "$GITHUB_REF" == refs/heads/main ]]; then
echo "path=." >> $GITHUB_OUTPUT
elif [[ "$GITHUB_REF" == refs/heads/develop ]]; then
echo "path=develop" >> $GITHUB_OUTPUT
fi
- name: Deploy to GitHub Pages
if: github.event_name != 'pull_request' && github.event_name != 'release'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
destination_dir: ${{ steps.deploy-path.outputs.path }}
keep_files: true