-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (63 loc) · 1.88 KB
/
deploy-web.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
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Deploy Schemius web client
on:
push:
branches:
- main
env:
WORK_DIR: ./schemius-web
WEB_PAGE_SOURCE: schemius-web.html
WEB_PAGE: index.html
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Add Rust WASM target
run: rustup target add wasm32-unknown-unknown
- name: Build WASM package
run: wasm-pack build --release --target web
working-directory: ${{ env.WORK_DIR }}
- name: Generate final web page
run: cp $WEB_PAGE_SOURCE $WEB_PAGE
working-directory: ${{ env.WORK_DIR }}
- name: Upload web page artifact
uses: actions/upload-artifact@v3
with:
name: web-page
path: ${{ env.WORK_DIR }}/${{ env.WEB_PAGE }}
if-no-files-found: error
- name: Upload WASM package artifact
uses: actions/upload-artifact@v3
with:
name: wasm-pkg
path: ${{ env.WORK_DIR }}/pkg
if-no-files-found: error
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download web page artifact
uses: actions/download-artifact@v3
with:
name: web-page
path: ./dist
- name: Download WASM package artifact
uses: actions/download-artifact@v3
with:
name: wasm-pkg
path: ./dist/pkg
- name: Remove vicious .gitignore
run: rm ./dist/pkg/.gitignore
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist