-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74f3955
commit 34cefa7
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Deploy web | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
cache-dependency-path: web/package-lock.json | ||
|
||
- name: Install wasm-pack | ||
uses: jetli/[email protected] | ||
|
||
- name: Cache WASM build | ||
uses: actions/cache@v4 | ||
with: | ||
path: backend/target | ||
key: cargo-${{ hashFiles('backend/Cargo.lock') }} | ||
|
||
- name: Build web app | ||
run: | | ||
cd web | ||
npm ci | ||
npm run wasm-release | ||
npm run build --if-present | ||
# TODO Vite suddenly broke and I have no idea why. Hack around it. | ||
# new URL('backend_bg.wasm', import.meta.url) doesn't exist at build time, it will remain unchanged to be resolved at runtime | ||
ln -s assets/backend_bg.wasm dist/ | ||
- name: Publish | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./web/dist/ |