Files
frp-panel/.github/workflows/wiki.workflow.yml
T
2025-04-13 07:18:52 +00:00

88 lines
2.5 KiB
YAML

name: Deploy VitePress site to Pages
on:
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
# Step 2: Setup Node.js and pnpm
- name: Setup Node.js and pnpm
uses: actions/setup-node@v4
with:
node-version: "20" # Use Node.js version 20
cache: "pnpm" # Enable pnpm cache
cache-dependency-path: "docs"
# Step 3: Install pnpm
- name: Install pnpm
run: npm install -g pnpm
# Step 4: Restore cache for pnpm and VitePress build
- name: Restore cache
uses: actions/cache@v4
with:
# Cache pnpm store and .vitepress cache
path: |
~/.pnpm-store
docs/.vitepress/cache
# Generate a cache key based on lock file and source files
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# Fallback to a partial cache if lock file changes
restore-keys: |
${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}-
# Step 5: Install dependencies using pnpm
- name: Install dependencies
working-directory: ./docs
run: pnpm install
# Step 6: Build the VitePress site
- name: Build with VitePress
working-directory: ./docs
run: pnpm vitepress build
# Step 7: Upload artifact for deployment
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
# Step 1: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4