Merge pull request #33 from jthemphill/vite #437
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: build | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22.6" | |
cache: yarn | |
- name: Cache assets | |
uses: actions/cache@v4 | |
with: | |
path: | | |
assets/icons | |
assets/static | |
assets/data | |
key: assets-${{ hashFiles('assets/**') }} | |
restore-keys: assets- | |
- name: Yarn setup | |
run: yarn install --frozen-lockfile | |
- name: Fetch assets | |
run: yarn fetch-assets | |
- name: Lint and typecheck | |
run: yarn run check | |
- name: Build site | |
run: yarn build | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
path: ./dist | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |