chore(github-actions): build + deploy frontend #1
This file contains hidden or 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: web-host | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown wasm32-wasip1 | |
| override: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| - uses: extractions/setup-just@v3 | |
| - name: Install cargo-component | |
| run: cargo install cargo-component@0.21.1 | |
| - name: Install JavaScript dependencies | |
| run: npm install | |
| - name: Build | |
| run: npm run web-host:build | |
| - name: Cache build artifacts | |
| id: cache-build-www-host | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./packages/web-host/dist | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| deploy: | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Restore cached build artifacts | |
| id: cache-build-www-host-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ./packages/web-host/dist | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./packages/web-host/dist | |
| - name: Deploy GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |