Files
SnapOtter/.github/workflows/deploy-docs.yml
T
SnapOtterandGitHub 54073a7c50 fix(landing,docs): use build-time GitHub star count, drop per-page api.github.com fetch (#560)
Removes the client-side api.github.com fetch from the landing navbar and the docs theme; both now render a build-time star count (docs via a new VitePress data loader). deploy-docs.yml gets GITHUB_TOKEN plus a daily refresh cron, mirroring deploy-landing.yml. Fixes #555.
2026-07-18 10:45:28 +08:00

42 lines
1.2 KiB
YAML

name: Deploy Docs to Cloudflare Pages
on:
push:
branches: [main]
paths:
- "apps/docs/**"
# Daily rebuild so the build-time GitHub star count refreshes even when no
# docs files changed (mirrors deploy-landing.yml, offset an hour so the two
# scheduled deploys don't fire at once).
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
concurrency:
group: deploy-docs
cancel-in-progress: true
permissions:
contents: read
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: ./.github/actions/setup
- name: Build Docs
run: pnpm --filter @snapotter/docs docs:build
env:
# Authenticated GitHub API (5,000 req/hr) so the build-time star-count
# fetch isn't rate-limited on shared runner IPs (60 req/hr unauth).
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Cloudflare Pages
run: npx wrangler pages deploy apps/docs/.vitepress/dist --project-name snapotter-docs --branch main --commit-dirty=true
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}