Merge pull request #9 from wasv/fix-feature-gate #76
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
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 |