Skip to content

Commit 8e00f82

Browse files
authored
docs: Enable documentation ci (#1147)
This PR enables the CI integration and build of the VitePress docs JIRA: CPOUI5FOUNDATION-899
1 parent 2074a75 commit 8e00f82

File tree

14 files changed

+958
-918
lines changed

14 files changed

+958
-918
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
name: Deploy VitePress site to gh-pages
3+
4+
on:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: write
12+
pages: write
13+
id-token: write
14+
15+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: false
20+
21+
jobs:
22+
# Build job
23+
deploy-docs:
24+
runs-on: ubuntu-24.04
25+
env:
26+
DOC_VERSION: v5 # The directory in gh-pages where the documentation would be deployed
27+
DOC_ALIAS: next # Change this to update the alias route. Note: Check the old alias when changing this!
28+
GIT_COMMITTER_NAME: "OpenUI5 Bot"
29+
GIT_COMMITTER_EMAIL: "[email protected]"
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5
34+
with:
35+
fetch-depth: 0
36+
- name: Setup Node
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version: 22.20.0
40+
cache: npm
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v4
43+
- name: Install dependencies
44+
run: npm ci --engine-strict # --engine-strict is used to fail-fast if deps require node versions unsupported by the repo
45+
- name: Install documentation dependencies
46+
working-directory: packages/documentation
47+
run: npm ci --engine-strict # --engine-strict is used to fail-fast if deps require node versions unsupported by the repo
48+
- name: Fetch gh-pages branch
49+
run: git fetch origin gh-pages --depth=1
50+
- name: generate CLI doc
51+
working-directory: packages/documentation
52+
run: npm run generate-cli-doc
53+
- name: Build vitepress build
54+
working-directory: packages/documentation
55+
run: |
56+
# The base output
57+
npm run build:vitepress -- --base="/${{ github.event.repository.name }}/${DOC_VERSION}/"
58+
npm run build:assets -- ./dist
59+
# The alias output
60+
npm run build:vitepress -- --base="/${{ github.event.repository.name }}/${DOC_ALIAS}/" --outDir="dist-${DOC_ALIAS}"
61+
npm run build:assets -- ./dist-${DOC_ALIAS}
62+
- name: Build jsdoc
63+
working-directory: packages/documentation
64+
run: npm run jsdoc-generate
65+
# TODO: Skip for now deployment of the schema until we do a Schema Version 5 release
66+
# - name: Build Schema
67+
# run: |
68+
# npm run schema-generate
69+
# npm run schema-workspace-generate
70+
- name: Checkout gh-pages
71+
uses: actions/checkout@v5
72+
with:
73+
ref: gh-pages
74+
path: gh-pages
75+
- name: Copy the additional resources to gh-pages
76+
run: |
77+
# TODO: Skip for now deployment of the schema until we do a Schema Version 5 release
78+
# rm -rf ./gh-pages/schema
79+
# cp -R ./site/schema ./gh-pages/
80+
rm -rf ./gh-pages/${DOC_VERSION}
81+
rm -rf ./gh-pages/${DOC_ALIAS}
82+
83+
# Main version route
84+
cp -R ./packages/documentation/dist ./gh-pages/${DOC_VERSION}/
85+
86+
# Alias route. E.g., next, latest, stable, etc.
87+
# For vitepress must be a copy with different config, not a symlink
88+
cp -R ./packages/documentation/dist-${DOC_ALIAS} ./gh-pages/${DOC_ALIAS}/
89+
# Symlink the api docs to avoid duplication
90+
ln -s ../${DOC_VERSION}/api ./gh-pages/${DOC_ALIAS}/api
91+
92+
# TODO: Enable when v5 release is done
93+
# cp ./packages/documentation/scripts/resources/custom404.html ./gh-pages/404.html
94+
- name: Publish Docs
95+
run: |
96+
cd ./gh-pages
97+
git config --local user.email $GIT_COMMITTER_EMAIL
98+
git config --local user.name $GIT_COMMITTER_NAME
99+
git add .
100+
git commit -m "Updating supplemental resources for ${DOC_VERSION} documentation deployment"
101+
git push

.github/workflows/github-ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ jobs:
4040
run: npm run coverage
4141

4242
- name: Generate JSDoc documentation
43-
run: cd packages/documentation && npm ci && npm run jsdoc-generate
43+
working-directory: packages/documentation
44+
run: |
45+
npm ci --engine-strict # --engine-strict is used to fail-fast if deps require node versions unsupported by the repo
46+
npm run jsdoc-generate
4447
4548
- name: Generate merged JSON schema
4649
run: npm run schema-generate
4750

4851
- name: Generate CLI documentation
52+
working-directory: packages/documentation
4953
run: npm run generate-cli-doc

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ Please check our [Contribution Guidelines](https://github.com/UI5/cli/blob/main/
5151
## Support
5252

5353
Please follow our [Contribution Guidelines](https://github.com/UI5/cli/blob/main/CONTRIBUTING.md#report-an-issue) on how to report an issue. Or chat with us in the [`#tooling`](https://openui5.slack.com/archives/C0A7QFN6B) channel of the [OpenUI5 Community Slack](https://ui5-slack-invite.cfapps.eu10.hana.ondemand.com). For public Q&A, use the [`ui5-tooling` tag on Stack Overflow](https://stackoverflow.com/questions/tagged/ui5-tooling).
54+
55+
## Kudos
56+
Thanks goes out for the amazing [UI5 VitePress|https://github.com/hschaefer123/ui5-vitepress] project offered by [Holger Schäfer|https://github.com/hschaefer123] on which the UI5 CLI documentation is based.

REUSE.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ SPDX-License-Identifier = "Apache-2.0"
2626
path = "packages/builder/lib/processors/jsdoc/lib/**"
2727
precedence = "aggregate"
2828
SPDX-FileCopyrightText = "2025 SAP SE or an SAP affiliate company and OpenUI5 contributors"
29-
SPDX-License-Identifier = "Apache-2.0"
29+
SPDX-License-Identifier = "Apache-2.0"
30+
31+
[[annotations]]
32+
path = "packages/documentation/.vitepress/**"
33+
precedence = "aggregate"
34+
SPDX-FileCopyrightText = ["2019-present, Konrad Kost, Holger Schäfer, Yuxi (Evan) and VitePress contributors"]
35+
SPDX-License-Identifier = "MIT"

package-lock.json

Lines changed: 0 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"coverage": "npm run coverage --workspaces",
3131
"schema-generate": "node ./scripts/buildSchema.js ui5",
3232
"schema-workspace-generate": "node ./scripts/buildSchema.js ui5-workspace",
33-
"generate-cli-doc": "node ./scripts/generateCliDoc.js",
3433
"depcheck": "depcheck --ignores @ui5/builder,@ui5/cli,@ui5/fs,@ui5/logger,@ui5/project,@ui5/server,local-web-server,@commitlint/config-conventional,husky && npm run depcheck --workspaces",
3534
"check-licenses": "licensee --errors-only"
3635
},
@@ -53,7 +52,6 @@
5352
"eslint-plugin-ava": "^15.1.0",
5453
"eslint-plugin-jsdoc": "^61.1.0",
5554
"globals": "^16.4.0",
56-
"handlebars": "^4.7.8",
5755
"husky": "^9.1.7",
5856
"licensee": "^11.1.1",
5957
"local-web-server": "^5.4.0",

packages/documentation/.vitepress/config.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import MarkdownItImplicitFigures from "markdown-it-implicit-figures";
77

88
export default defineConfig({
99

10-
base: "/cli/v5/", // GitHub Pages deployment base path
10+
// Would be set in CI job via CLI arguments. For local development, it's just root.
11+
base: "/",
1112
srcDir: "docs",
1213
outDir: "dist",
1314
lang: "en-US",
@@ -104,17 +105,17 @@ function nav() {
104105
items: [
105106
{
106107
text: 'V4',
107-
link: '../v4/',
108+
link: `/../v4/`,
108109
target: "_self"
109110
},
110111
{
111112
text: 'V3',
112-
link: '../v3/',
113+
link: `/../v3/`,
113114
target: "_self"
114115
},
115116
{
116117
text: 'V2',
117-
link: '../v2/',
118+
link: `/../v2/`,
118119
target: "_self"
119120
}
120121
]
@@ -274,7 +275,8 @@ function guide() {
274275
},
275276
{
276277
text: "API Reference",
277-
link: "https://ui5.github.io/cli/api/index.html",
278+
link: "/api/index.html",
279+
target: "_blank"
278280

279281
},
280282

packages/documentation/docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import VPButton from "vitepress/dist/client/theme-default/components/VPButton.vu
1010
const { isDark } = useData()
1111
</script>
1212

13-
<img :src="isDark ? '/cli/v5/images/O_UI5_H_noBG.png' : '/cli/v5/images/UI5_logo_wide.png'" alt="UI5 logo" style="max-width: 100%; height: auto;">
13+
<img :src="isDark ? './images/O_UI5_H_noBG.png' : './images/UI5_logo_wide.png'" alt="UI5 logo" style="max-width: 100%; height: auto;">
1414

1515
# UI5 CLI
1616

0 commit comments

Comments
 (0)