Deploy docs site (VitePress) workflow (notionnext-org/NotionNext)
The Deploy docs site (VitePress) workflow from notionnext-org/NotionNext, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Deploy docs site (VitePress) workflow from the notionnext-org/NotionNext repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# VitePress 文档站 → Cloudflare Pages(不依赖 CF「连接 Git」)
# 适用于组织仓库、个人仓库均可。需在 GitHub 配置 Secrets,见 docs/user-guide/deploy/cloudflare-pages-docs.md
name: Deploy docs site (VitePress)
on:
push:
branches:
- main
paths:
- 'docs/**'
- '.vitepress/**'
- 'README.md'
- 'functions/**'
- 'scripts/generate-theme-user-docs.mjs'
- 'package.json'
- 'yarn.lock'
- '.github/workflows/deploy-docs-site.yml'
workflow_dispatch:
concurrency:
group: deploy-docs-site
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build VitePress
env:
VITE_GISCUS_REPO_ID: ${{ secrets.VITE_GISCUS_REPO_ID }}
VITE_GISCUS_CATEGORY_ID: ${{ secrets.VITE_GISCUS_CATEGORY_ID }}
VITE_GISCUS_ENABLED: ${{ vars.VITE_GISCUS_ENABLED }}
VITE_DOCS_CHAT_API: /api/docs-chat
run: yarn docs:site:build
- name: Set Pages project name
run: echo "CF_PAGES_PROJECT=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || 'notionnext-docs' }}" >> "$GITHUB_ENV"
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy .vitepress/dist --project-name=${{ env.CF_PAGES_PROJECT }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# VitePress 文档站 → Cloudflare Pages(不依赖 CF「连接 Git」) # 适用于组织仓库、个人仓库均可。需在 GitHub 配置 Secrets,见 docs/user-guide/deploy/cloudflare-pages-docs.md name: Deploy docs site (VitePress) on: push: branches: - main paths: - 'docs/**' - '.vitepress/**' - 'README.md' - 'functions/**' - 'scripts/generate-theme-user-docs.mjs' - 'package.json' - 'yarn.lock' - '.github/workflows/deploy-docs-site.yml' workflow_dispatch: concurrency: group: deploy-docs-site cancel-in-progress: true jobs: deploy: timeout-minutes: 30 runs-on: latchkey-small permissions: contents: read deployments: write steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node uses: actions/setup-node@v4 with: node-version: 22 cache: 'yarn' - name: Install dependencies run: yarn install --frozen-lockfile - name: Build VitePress env: VITE_GISCUS_REPO_ID: ${{ secrets.VITE_GISCUS_REPO_ID }} VITE_GISCUS_CATEGORY_ID: ${{ secrets.VITE_GISCUS_CATEGORY_ID }} VITE_GISCUS_ENABLED: ${{ vars.VITE_GISCUS_ENABLED }} VITE_DOCS_CHAT_API: /api/docs-chat run: yarn docs:site:build - name: Set Pages project name run: echo "CF_PAGES_PROJECT=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || 'notionnext-docs' }}" >> "$GITHUB_ENV" - name: Deploy to Cloudflare Pages uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} command: pages deploy .vitepress/dist --project-name=${{ env.CF_PAGES_PROJECT }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.