-
-
Notifications
You must be signed in to change notification settings - Fork 6
81 lines (76 loc) · 3.03 KB
/
Copy pathdocs.yml
File metadata and controls
81 lines (76 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Docs
on:
# Live site tracks GitHub Releases only — unreleased work on main /
# release branches does not publish until a version is cut.
#
# This fires only for a release published by hand in the UI. A release created
# by the Release workflow uses the default GITHUB_TOKEN, and GitHub does not
# start workflow runs for events that token raises, so release.yml dispatches
# this workflow explicitly (its publish-docs job) instead of relying on it.
release:
types: [published]
pull_request:
paths:
- "website/**"
- "docs/**"
- "README.md"
- "CONTRIBUTING.md"
- ".github/workflows/docs.yml"
# Manual republish of the latest release tag (or any ref) without cutting a
# new version — useful after a docs hotfix on an already-published tag.
workflow_dispatch:
inputs:
ref:
description: "Git ref to build and deploy (tag, branch, or SHA). Empty = this workflow ref."
required: false
type: string
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.release.tag_name || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Runs on PRs too: the Astro build fails on broken internal links
# (starlight-links-validator) and on missing include markers, so a docs PR
# with a dead link or a broken README include fails here.
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Release / dispatch: build the tagged (or requested) tree so Pages
# matches that version, not whatever happens to be on the default branch.
ref: ${{ inputs.ref || github.event.release.tag_name || github.ref }}
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: npm
cache-dependency-path: website/package-lock.json
- run: npm ci
working-directory: website
- run: npm run build
working-directory: website
- if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: website/dist
deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# One-time prerequisite: enable Pages with Settings → Pages → Source:
# "GitHub Actions" (or `gh api -X POST repos/<owner>/<repo>/pages
# -f build_type=workflow`). GITHUB_TOKEN cannot enable Pages itself —
# configure-pages `enablement` needs an admin token, so it is not used.
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0