Files

77 lines
1.9 KiB
YAML

name: Build and deploy the docs site
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs.yaml'
# The build checks the config reference pages against these, so a changed default fails here
- 'app/config.json'
- 'upload-app/config.json'
schedule:
# Weekly rebuild, so the navbar's star count stays current
- cron: '0 3 * * 1'
permissions:
contents: read
pages: write
id-token: write
# One deploy at a time, and let a running one finish rather than cancelling it part-way.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Full history: VitePress reads git timestamps for the "last updated" line.
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: docs
# Dead internal links fail the build, which fails the workflow and leaves the live site untouched.
# The token lifts the GitHub API rate limit for the star-count fetch in .vitepress/config.ts.
- name: Build site
run: npm run build
working-directory: docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload build output
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4