Files
skillshare/.github/workflows/website-pages.yml
T
Willie fe6584bc67 ci(website): build the docs only for pushes to main
Pull requests that touched website/ ran the full docs build, and a fork's
PR waited for approval to run it. Pushes to main still build and deploy,
so a broken link fails that run instead of the PR.

A newer push now cancels a run still in progress, so an older build
can no longer deploy stale docs over a newer one.
2026-09-27 19:28:48 +08:00

72 lines
1.7 KiB
YAML

name: Website Pages
on:
push:
branches: [main]
paths:
- "website/**"
- ".github/workflows/website-pages.yml"
workflow_dispatch:
permissions:
contents: read
deployments: write
# Only the newest push matters: an older run still building would deploy stale docs over it.
concurrency:
group: website-pages
cancel-in-progress: true
env:
CLOUDFLARE_PROJECT_NAME: skillshare
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check AI context routes
run: python3 scripts/ai-context.py check
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: website
run: npm ci
- name: Build website
working-directory: website
run: npm run build
- name: Upload Pages artifact
uses: actions/upload-artifact@v4
with:
name: website-build
path: website/build
retention-days: 1
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Pages artifact
uses: actions/download-artifact@v4
with:
name: website-build
path: website/build
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy website/build --project-name=${{ env.CLOUDFLARE_PROJECT_NAME }} --branch=${{ github.ref_name }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}