Skip to content

Commit 27f1134

Browse files
committed
Add deploy
1 parent 258438d commit 27f1134

8 files changed

Lines changed: 298 additions & 229 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- 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: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup npm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 8
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20'
34+
cache: 'pnpm'
35+
36+
- name: Setup Rust
37+
uses: actions-rust-lang/setup-rust-toolchain@v1
38+
with:
39+
target: wasm32-unknown-unknown
40+
41+
- name: Install wasm-pack
42+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
43+
44+
- name: Build
45+
run: make all
46+
47+
- name: Setup Pages
48+
uses: actions/configure-pages@v4
49+
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: './ts/dist'
54+
55+
deploy:
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
runs-on: ubuntu-latest
60+
needs: build
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

Cargo.lock

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ all: $(RS_LIB) $(TS_MAIN)
1313

1414
clean:
1515
(cd $(RS_SRC); cargo clean)
16-
-rm $(RS_LIB) $(TS_MAIN)
17-
-rm -rf $(TS_DIST)
16+
-rm -rf node_modules $(TS_ROOT)node_modules $(TS_LIB) $(TS_DIST)
1817

1918
update:
2019
cargo update
@@ -28,7 +27,6 @@ $(RS_LIB): $(RS_SRC)src/*.rs
2827
(cd $(RS_SRC); wasm-pack build --target web --out-dir ../$(TS_LIB))
2928

3029
$(TS_MAIN): $(RS_LIB) $(TS_SRC)*.ts
31-
echo "export const HASH = \"`git rev-parse --short HEAD`\";" > $(TS_ROOT)src/hash.ts
3230
(cd $(TS_ROOT); pnpm i; pnpm run build)
3331

3432
server:

0 commit comments

Comments
 (0)