-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (84 loc) · 3.16 KB
/
Copy pathdocs.yml
File metadata and controls
100 lines (84 loc) · 3.16 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Deploy docs
on:
push:
branches: [main]
paths:
- '.github/workflows/docs.yml'
- 'docs-site/**'
- 'host/src/**'
- 'host/typedoc.json'
- 'host/package.json'
- 'host/package-lock.json'
- 'host/tsconfig.json'
- 'host/tsconfig.docs.json'
- 'host/tsup.config.ts'
- 'package.json'
- 'package-lock.json'
jobs:
deploy-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '22'
- name: Detect docs changes
id: changes
shell: bash
run: |
base="${{ github.event.before }}"
if ! git rev-parse --verify "$base^{commit}" >/dev/null 2>&1; then
base="$(git rev-list --max-parents=0 HEAD)"
fi
changed_files="$(git diff --name-only "$base" "$GITHUB_SHA")"
printf '%s\n' "$changed_files"
api_docs=false
user_guide=false
if printf '%s\n' "$changed_files" | grep -Eq '^(\.github/workflows/docs\.yml$|host/src/|host/typedoc\.json$|host/package\.json$|host/package-lock\.json$|host/tsconfig\.json$|host/tsconfig\.docs\.json$|host/tsup\.config\.ts$)'; then
api_docs=true
fi
if printf '%s\n' "$changed_files" | grep -Eq '^(\.github/workflows/docs\.yml$|docs-site/|package\.json$|package-lock\.json$)'; then
user_guide=true
fi
echo "api_docs=$api_docs" >> "$GITHUB_OUTPUT"
echo "user_guide=$user_guide" >> "$GITHUB_OUTPUT"
- name: Install guide dependencies
if: steps.changes.outputs.user_guide == 'true'
run: npm ci --no-audit --no-fund
- name: Build user guide
if: steps.changes.outputs.user_guide == 'true'
env:
VITEPRESS_BASE: /kandelo/guide/
run: npm run docs:build
- name: Deploy user guide to gh-pages
if: steps.changes.outputs.user_guide == 'true'
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs-site/.vitepress/dist
destination_dir: guide
keep_files: true
- name: Install API dependencies
if: steps.changes.outputs.api_docs == 'true'
working-directory: host
run: npm ci
- name: Typecheck API docs
if: steps.changes.outputs.api_docs == 'true'
working-directory: host
run: npx tsc --noEmit -p tsconfig.docs.json
- name: Build API docs
if: steps.changes.outputs.api_docs == 'true'
working-directory: host
run: npx typedoc
- name: Deploy API docs to gh-pages
if: steps.changes.outputs.api_docs == 'true'
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: host/docs
destination_dir: api
keep_files: true