Skip to content

deploy

deploy #3

Workflow file for this run

# .github/workflows/deploy.yml
name: Deploy VitePress site to GitHub Pages
on:
push:
branches:
- main # Change to 'master' if that is your main branch
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Required permissions for the deployment action to work
permissions:
contents: read
pages: write
id-token: write
jobs:
build_and_deploy:
runs-on: ubuntu-latest
# Environment needed for deployment to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# 1. Checkout the code
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for generating git history if used on the site
# 2. Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20 # Recommended to use a recent LTS version
# We no longer need to specify 'cache: pnpm' here,
# as the dedicated pnpm action handles setup and caching.
# 3. FIX: Setup pnpm using the dedicated action
# This guarantees pnpm is installed and available in the PATH.
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8 # Specify a stable version of pnpm (or leave it out for latest)
run_install: false # We will run the installation separately (step 4)
# 4. Install dependencies
- name: Install dependencies (pnpm)
run: pnpm install --frozen-lockfile
# 5. Build the VitePress site
# Uses the "docs:build" script from package.json
- name: Build VitePress site
run: pnpm run docs:build
# 6. Configure the deployment artifact
- name: Setup Pages
uses: actions/configure-pages@v5
# 7. Upload the generated artifacts (the 'dist' folder)
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Default output directory for VitePress
path: docs/.vitepress/dist
# 8. Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4