# Builds the VitePress documentation site under docs/ and deploys it to # GitHub Pages. On pull requests the site is only built (to catch breakage); # on push to main and on manual dispatch it is built and deployed. name: Docs Deploy on: pull_request: paths: - "docs/**" - ".github/workflows/docs-deploy.yml" push: branches: - main paths: - "docs/**" - ".github/workflows/docs-deploy.yml" workflow_dispatch: permissions: contents: read concurrency: group: pages-${{ github.ref }} cancel-in-progress: false jobs: build: runs-on: ubuntu-latest timeout-minutes: 15 steps: - name: Download code uses: actions/checkout@v6 with: fetch-depth: 0 - name: Prepare Node uses: actions/setup-node@v4 with: node-version: "20" cache: npm cache-dependency-path: docs/package-lock.json - name: Install dependencies working-directory: docs run: npm ci - name: Build site working-directory: docs run: npm run build - name: Upload Pages artifact if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 with: path: docs/.vitepress/dist deploy: if: github.event_name != 'pull_request' needs: build runs-on: ubuntu-latest timeout-minutes: 10 # Only this job touches Pages: the build job runs on pull_requests (including # same-repo branches) and executes third-party dependency postinstall code, so it # must not hold Pages/OIDC write capabilities. permissions: contents: read pages: write id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4