Skip to content

Commit b86c36e

Browse files
authored
Update build-wasm.yml
1 parent 676bfae commit b86c36e

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

.github/workflows/build-wasm.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,48 @@
1-
name: Build WebAssembly Hello World
1+
# .github/workflows/pages.yml
2+
name: Build & Deploy GitHub Pages (with WASM)
23

34
on:
45
push:
5-
branches: ["main"]
6-
pull_request:
7-
branches: ["main"]
6+
branches: [ main ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: true
817

918
jobs:
1019
build:
1120
runs-on: ubuntu-latest
12-
1321
steps:
14-
- name: Check out repository
15-
uses: actions/checkout@v4
22+
- uses: actions/checkout@v4
1623

17-
- name: Set up Emscripten SDK
18-
uses: mymindstorm/setup-emsdk@v12
24+
- uses: mymindstorm/setup-emsdk@v12
1925
with:
2026
version: 3.1.50
2127

22-
- name: Compile C89 hello world to WebAssembly
28+
- name: Build wasm
2329
run: |
24-
emcc \
25-
-std=c89 \
26-
-s STANDALONE_WASM=1 \
27-
wasm/hello.c \
28-
-o wasm/hello.wasm
29-
30-
- name: Upload WebAssembly artifact
31-
uses: actions/upload-artifact@v4
30+
emcc -std=c89 -s STANDALONE_WASM=1 wasm/hello.c -o wasm/hello.wasm
31+
32+
# If you use Jekyll, build here; otherwise just ship the repo contents.
33+
- name: Configure Pages
34+
uses: actions/configure-pages@v5
35+
- name: Upload site artifact
36+
uses: actions/upload-pages-artifact@v3
3237
with:
33-
name: hello-wasm
34-
path: wasm/hello.wasm
38+
path: . # ships your whole site, including wasm/hello.wasm
39+
40+
deploy:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
steps:
47+
- id: deployment
48+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)