Add gh workflow #1
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 to GitHub Pages | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test code | |
run: cargo test | |
- name: Install Wasm target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Compile for wasm | |
run: cargo build --release --target wasm32-unknown-unknown | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
cache-dependency-path: web/yarn.lock | |
- name: Install web dependencies | |
working-directory: web | |
run: yarn install | |
- name: Link Wasm | |
working-directory: web | |
run: yarn process-wasm | |
- name: Build web | |
working-directory: web | |
run: yarn build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./web/dist | |
deploy: | |
name: Deploy | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |