-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.48 KB
/
deploy.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
80
81
82
83
84
85
86
87
88
89
90
91
name: Deploy
on:
push:
branches:
- main
# tags:
# pull_request:
env:
CARGO_TERM_COLOR: always
# if a test fails, shows the backtrace
RUST_BACKTRACE: 1
# if depending on a ssh crate, use the git cli.
CARGO_NET_GIT_FETCH_WITH_CLI: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# rust compiler for running tests
- uses: actions/checkout@v2
- name: Install latest nightly (for linux-gnu)
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: x86_64-unknown-linux-gnu
components: rustfmt, clippy
# override: true
# rust compiler for creating binaries
- name: Install latest nightly (for wasm)
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-unknown-unknown
components: rustfmt, clippy
override: true
- name: Install wasm target
run: |
set -e
rustup target add wasm32-unknown-unknown
# Runs some Rust-related caching
- uses: Swatinem/rust-cache@v2
# Get Trunk (can prepare assets for publishing)
- uses: jetli/[email protected]
with:
version: 'latest'
# Used to optimize wasm binaries
# based on
# https://github.com/rustwasm/walrus/blob/9d6c9de432d6a97478dc76ebdf18aed51584c3af/.github/workflows/main.yml#L56
- name: Install binaryen
run: |
set -e
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_117-x86_64-linux.tar.gz | tar xzf -
echo "`pwd`/binaryen-version_117/bin" >> $GITHUB_PATH
# Build the Mamba App
- name: Trunk Build (Mamba)
run: |
set -e
trunk build --release --public-url ./
# Prepare assets for publishing
- name: Move and optimize assets
run: |
set -e
# Prepare the publishing structure
mkdir -p publish/
# move Mamba App assets
mv -vn ./dist/* publish/
# Optimize wasm binaries
find publish/ \
-name \*.wasm \
-prune \
-exec wasm-opt -Oz -o "{}" "{}" \;
# Publish
- name: Frontend Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./publish
keep_files: false