|
| 1 | +name: Docs site |
| 2 | + |
| 3 | +# The documentation site (website/) mirrors docs/*.md via scripts/sync-docs.mjs, |
| 4 | +# which runs as the first step of `pnpm run build`. This workflow rebuilds that |
| 5 | +# mirror and deploys the static export to Cloudflare Pages: |
| 6 | +# - on every push to main that touches docs/ or website/ (deploy immediately), |
| 7 | +# - on a daily schedule (re-mirror the latest docs even if nothing pushed), |
| 8 | +# - manually via the Actions tab, |
| 9 | +# - and as a build-only check on pull requests. |
| 10 | +# |
| 11 | +# Deploys require two repository secrets: CLOUDFLARE_API_TOKEN and |
| 12 | +# CLOUDFLARE_ACCOUNT_ID. Set the site's public URL via the DOCS_SITE_URL |
| 13 | +# repository variable (used for OG/sitemap absolute URLs). |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: [main] |
| 18 | + paths: |
| 19 | + - 'docs/**' |
| 20 | + - 'website/**' |
| 21 | + - '.github/workflows/deploy-docs.yml' |
| 22 | + pull_request: |
| 23 | + paths: |
| 24 | + - 'docs/**' |
| 25 | + - 'website/**' |
| 26 | + - '.github/workflows/deploy-docs.yml' |
| 27 | + schedule: |
| 28 | + # Daily at 06:00 UTC — picks up any docs changes merged since the last run. |
| 29 | + - cron: '0 6 * * *' |
| 30 | + workflow_dispatch: |
| 31 | + |
| 32 | +# Never run two deploys at once; let an in-flight deploy finish. |
| 33 | +concurrency: |
| 34 | + group: deploy-docs |
| 35 | + cancel-in-progress: false |
| 36 | + |
| 37 | +jobs: |
| 38 | + build-and-deploy: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + permissions: |
| 41 | + contents: read |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Setup pnpm |
| 46 | + uses: pnpm/action-setup@v4 |
| 47 | + |
| 48 | + - uses: actions/setup-node@v4 |
| 49 | + with: |
| 50 | + node-version: '20' |
| 51 | + cache: pnpm |
| 52 | + cache-dependency-path: website/pnpm-lock.yaml |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + working-directory: website |
| 56 | + run: pnpm install --frozen-lockfile |
| 57 | + |
| 58 | + - name: Build site (mirrors docs/*.md, then next build) |
| 59 | + working-directory: website |
| 60 | + env: |
| 61 | + NEXT_PUBLIC_SITE_URL: ${{ vars.DOCS_SITE_URL }} |
| 62 | + run: pnpm run build |
| 63 | + |
| 64 | + # Temporarily disabled until Cloudflare setup is ready. |
| 65 | + # - name: Deploy to Cloudflare Pages |
| 66 | + # # Only deploy from main on the canonical repo. This keeps PRs build-only, |
| 67 | + # # keeps forks (no secrets) build-only, and because the wrangler command |
| 68 | + # # below hardcodes `--branch=main` (a *production* deploy) prevents a |
| 69 | + # # `workflow_dispatch` on a feature branch from overwriting the live site. |
| 70 | + # if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'Fission-AI/OpenSpec' }} |
| 71 | + # uses: cloudflare/wrangler-action@v3 |
| 72 | + # with: |
| 73 | + # apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
| 74 | + # accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
| 75 | + # workingDirectory: website |
| 76 | + # command: pages deploy out --project-name=openspec-docs --branch=main |
0 commit comments