-
-
Notifications
You must be signed in to change notification settings - Fork 289
93 lines (78 loc) · 2.6 KB
/
docs.yml
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
name: Deploy docs
on:
push:
branches:
- stable
workflow_dispatch:
inputs:
ref:
description: 'Ref to deploy, defaults to `unstable`'
required: false
default: 'unstable'
type: string
jobs:
docs:
runs-on: buildjet-4vcpu-ubuntu-2204
env:
DEPLOY_REF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || 'stable' }}
steps:
# Validation step for workflow_dispatch ref input
- name: Validate Ref
if: github.event_name == 'workflow_dispatch'
run: |
if git rev-parse "${{ env.DEPLOY_REF }}" >/dev/null 2>&1; then
echo "Ref ${{ env.DEPLOY_REF }} is valid."
else
echo "Error: Ref ${{ env.DEPLOY_REF }} is not a valid branch, tag or commit." >&2
exit 1
fi
# Log out the ref being deployed
- name: Log Deployment Ref
if: github.event_name == 'workflow_dispatch'
run: |
echo "Deploying ref: $DEPLOY_REF"
# Checkout the correct ref being deployed
- uses: actions/checkout@v3
with:
ref: ${{ env.DEPLOY_REF }}
- uses: actions/setup-node@v3
with:
node-version: 20
check-latest: true
cache: yarn
- name: Node.js version
id: node
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
- name: Restore dependencies
uses: actions/cache@master
id: cache-deps
with:
path: |
node_modules
packages/*/node_modules
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }}
- name: Install & build
if: steps.cache-deps.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile && yarn build
- name: Build
run: yarn build
if: steps.cache-deps.outputs.cache-hit == 'true'
- name: Build and collect docs
run: yarn build:docs
- name: Lint built docs
run: yarn lint-docs:fix
- name: Set up Python
uses: actions/setup-python@v1
- name: Install dependencies
working-directory: docs
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build docs
working-directory: docs
run: mkdocs build --verbose --clean --site-dir site
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site