-
Notifications
You must be signed in to change notification settings - Fork 75
101 lines (94 loc) · 4.47 KB
/
deploy-vitepress-docs.yaml
File metadata and controls
101 lines (94 loc) · 4.47 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
101
# Sample workflow for building and deploying a VitePress site to GitHub Pages
name: Deploy VitePress site to gh-pages
on:
push:
branches: [main]
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false
jobs:
# Build job
deploy-docs:
runs-on: ubuntu-24.04
env:
DOC_VERSION: v5 # The directory in gh-pages where the documentation would be deployed
DOC_ALIAS: next # Change this to update the alias route. Note: Check the old alias when changing this!
GIT_COMMITTER_NAME: "OpenUI5 Bot"
GIT_COMMITTER_EMAIL: "openui5@sap.com"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22.20.0
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci --engine-strict # --engine-strict is used to fail-fast if deps require node versions unsupported by the repo
- name: Install documentation dependencies
working-directory: packages/documentation
run: npm ci --engine-strict # --engine-strict is used to fail-fast if deps require node versions unsupported by the repo
- name: Fetch gh-pages branch
run: git fetch origin gh-pages --depth=1
- name: generate CLI doc
working-directory: packages/documentation
run: npm run generate-cli-doc
- name: Build vitepress build
working-directory: packages/documentation
run: |
# The base output
npm run build:vitepress -- --base="/${{ github.event.repository.name }}/${DOC_VERSION}/"
npm run build:assets -- ./dist
# The alias output
npm run build:vitepress -- --base="/${{ github.event.repository.name }}/${DOC_ALIAS}/" --outDir="dist-${DOC_ALIAS}"
npm run build:assets -- ./dist-${DOC_ALIAS}
- name: Build jsdoc
working-directory: packages/documentation
run: npm run jsdoc-generate
# TODO: Skip for now deployment of the schema until we do a Schema Version 5 release
# - name: Build Schema
# run: |
# npm run schema-generate
# npm run schema-workspace-generate
- name: Checkout gh-pages
uses: actions/checkout@v5
with:
ref: gh-pages
path: gh-pages
- name: Copy the additional resources to gh-pages
run: |
# TODO: Skip for now deployment of the schema until we do a Schema Version 5 release
# rm -rf ./gh-pages/schema
# cp -R ./site/schema ./gh-pages/
rm -rf ./gh-pages/${DOC_VERSION}
rm -rf ./gh-pages/${DOC_ALIAS}
# Main version route
cp -R ./packages/documentation/dist ./gh-pages/${DOC_VERSION}/
# Alias route. E.g., next, latest, stable, etc.
# For vitepress must be a copy with different config, not a symlink
cp -R ./packages/documentation/dist-${DOC_ALIAS} ./gh-pages/${DOC_ALIAS}/
# Symlink the api docs to avoid duplication
ln -s ../${DOC_VERSION}/api ./gh-pages/${DOC_ALIAS}/api
# TODO: Enable when v5 release is done
# cp ./packages/documentation/scripts/resources/custom404.html ./gh-pages/404.html
- name: Publish Docs
run: |
cd ./gh-pages
git config --local user.email $GIT_COMMITTER_EMAIL
git config --local user.name $GIT_COMMITTER_NAME
git add .
git commit -m "Updating supplemental resources for ${DOC_VERSION} documentation deployment"
git push