Skip to content

Update workflows

Update workflows #2

name: Deploy Website
on:
push:
paths:
- "site/**"
branches:
- main
jobs:
install:
name: Install Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Tools & Cache
uses: ./.github/actions/setup
# Cache the installed node_modules directory
- name: Cache node_modules
uses: actions/cache@v4
id: node_modules_cache_id
with:
path: site/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('site/pnpm-lock.yaml') }}
# If the cache didn't exist, run pnpm install
- name: Install dependencies
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
working-directory: ./site
run: pnpm install
build:
name: Build
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: site/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('site/pnpm-lock.yaml') }}
- name: Build
working-directory: ./site
run: pnpm run build
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
path: "site/build/"
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4