-
Notifications
You must be signed in to change notification settings - Fork 19
69 lines (58 loc) · 1.59 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
name: Deploy web frontend
on:
push:
branches: [ main ]
pull_request:
env:
CARGO_TERM_COLOR: always
BUILD_MODE: production
jobs:
deploy:
name: Deploy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- id: toolchain
name: Install nightly toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: rust-src
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '17'
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: cargo-registry
enableCrossOsArchive: true
- name: Cache build directory
uses: actions/cache@v4
with:
path: target/
key: web-release-${{ steps.toolchain.outputs.cachekey }}
- name: Update dependencies
run: cargo update
- name: Build
working-directory: frontend/web
run: |
# Ugly hack to work around wasm-pack not supporting custom profiles
sed -i 's/debug = true//' ../../Cargo.toml
sed -i 's/\[profile\.ci\]//' ../../Cargo.toml
sed -i 's/inherits = "release"//' ../../Cargo.toml
npm install
npm run build
rm dist/pkg/.gitignore
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: frontend/web/dist
force_orphan: true
publish_branch: web-deploy