.github/workflows/publish.yml #69
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
on: | |
schedule: | |
- cron: '0 3 * * TUE' | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build database and frontend | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
persist-credentials: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'frontend/package-lock.json' | |
- name: Install npm dependencies | |
run: npm ci | |
working-directory: frontend | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a | |
with: | |
toolchain: "stable" | |
- name: Rust cache | |
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab | |
with: | |
shared-key: "build" | |
- name: Download db-dump | |
run: wget --no-verbose https://static.crates.io/db-dump.tar.gz | |
- name: Build database | |
run: cargo run --locked --release --bin read-driver-db | |
- name: Copy generated database to frontend | |
run: cp full-crate-db.json frontend/src/ | |
- name: Build frontend | |
run: npm run build -- --base="/${{github.event.repository.name}}/" | |
working-directory: frontend | |
- name: Updload to gh-pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: frontend/dist | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |