Skip to content

Commit 3cc04d2

Browse files
Snooz82Copilot
andauthored
added versioning to syllabus and added Release 1.0.1 to the versioned docs (#92)
Previews will include a version called `next` which is the current working head. Production Builds will only contain versioned version. Adds Docusaurus docs versioning for the syllabus so that preview builds include the current “next” docs while production builds publish only released versions, and introduces the first released docs snapshot (1.0.1). **Changes:** - Added `1.0.1` as the first versioned docs release (versions list, versioned sidebars, and versioned docs content). - Introduced preview vs production build modes via `DOCS_BUILD_MODE`, plus corresponding npm scripts and CI workflow updates. - Adjusted the remark code-block line-length check to skip `versioned_docs` snapshots and added a docs version dropdown in the navbar. --------- Signed-off-by: René <snooz@posteo.de> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 1cd45aa commit 3cc04d2

50 files changed

Lines changed: 5976 additions & 699 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pr-preview-surge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
run: npm ci
6565

6666
- name: Build
67-
run: npm run build
67+
run: npm run build:preview
6868

6969
- name: Upload build artifact
7070
uses: actions/upload-artifact@v4

.github/workflows/release-pages.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ jobs:
1818
ref: ${{ github.event.release.tag_name }}
1919
fetch-depth: 0
2020

21+
- name: Verify matching versioned docs exist
22+
shell: bash
23+
run: |
24+
RELEASE_TAG="${{ github.event.release.tag_name }}"
25+
# Strip a leading 'v' from the tag (e.g. v1.0.1 → 1.0.1)
26+
VERSION="${RELEASE_TAG#v}"
27+
DOCS_DIR="website/versioned_docs/version-${VERSION}"
28+
29+
if [[ ! -d "${DOCS_DIR}" ]]; then
30+
echo "::error::Missing docs snapshot for release tag '${RELEASE_TAG}'."
31+
echo "Expected directory: ${DOCS_DIR}"
32+
echo "Available directories in website/versioned_docs:"
33+
ls -1 website/versioned_docs || true
34+
exit 1
35+
fi
36+
37+
echo "Found matching docs directory: ${DOCS_DIR}"
38+
2139
- name: Use Node.js
2240
uses: actions/setup-node@v4
2341
with:
@@ -31,7 +49,7 @@ jobs:
3149

3250
- name: Build website
3351
working-directory: ./website
34-
run: npm run build
52+
run: npm run build:production
3553

3654
- name: Deploy to gh-pages
3755
uses: peaceiris/actions-gh-pages@v3

website/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ $ npm run build
3030

3131
This command generates static content into the `build` directory and can be served using any static contents hosting service.
3232

33+
Build modes:
34+
35+
```
36+
$ npm run build:preview
37+
```
38+
39+
Builds docs with both released versions and `next` content.
40+
41+
```
42+
$ npm run build:production
43+
```
44+
45+
Builds docs with released versions only (hides `next`).
46+
3347
### Deployment
3448

3549
Using SSH:

website/docusaurus.config.ts

Lines changed: 98 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
// @ts-check
2-
// Note: type annotations allow type checking and IDEs autocompletion
3-
4-
const lightCodeTheme = require('prism-react-renderer').themes.vsLight;
5-
const darkCodeTheme = require('prism-react-renderer').themes.dracula;
1+
import { themes as prismThemes } from 'prism-react-renderer';
62
import remarkDirective from "remark-directive";
73
import remarkTermDirective from "./src/remark/remark-term-directive.js";
84
import codeMaxLineLength from './src/remark/remark-code-max-line-length.js';
5+
import type { Config } from '@docusaurus/types';
6+
import type * as Preset from '@docusaurus/preset-classic';
7+
8+
const rawDocsBuildMode = process.env.DOCS_BUILD_MODE ?? 'preview';
99

10+
if (!['preview', 'production'].includes(rawDocsBuildMode)) {
11+
throw new Error(
12+
`Invalid DOCS_BUILD_MODE: "${rawDocsBuildMode}". Expected "preview" or "production".`,
13+
);
14+
}
1015

11-
/** @type {import('@docusaurus/types').Config} */
12-
const config = {
16+
const includeCurrentVersion = rawDocsBuildMode === 'preview';
17+
18+
const config: Config = {
1319
title: 'Syllabus of Robot Framework® Certified Professional',
1420
tagline: 'The foundation for the "Robot Framework® Certified Professional" (RFCP®) exam and training',
1521
url: 'https://robotframework.org',
@@ -25,105 +31,111 @@ const config = {
2531
future: {
2632
v4: true, // Improve compatibility with the upcoming Docusaurus v4
2733
},
28-
organizationName: 'robotframework', // Usually your GitHub org/user name.
29-
projectName: 'robotframework-RFCP-syllabus', // Usually your repo name.
34+
organizationName: 'robotframework',
35+
projectName: 'robotframework-RFCP-syllabus',
3036
trailingSlash: false,
3137
presets: [
3238
[
3339
'classic',
34-
/** @type {import('@docusaurus/preset-classic').Options} */
3540
({
3641
docs: {
42+
includeCurrentVersion,
3743
admonitions: {
3844
keywords: ['lo', 'K1', 'K2', 'K3', 'note', 'tip', 'info', 'warning', 'danger'],
3945
extendDefaults: true,
4046
},
41-
routeBasePath: '/docs',
42-
sidebarPath: require.resolve('./sidebars.js'),
43-
// Please change this to your repo.
44-
// editUrl: 'https://github.com/robotframework/robotframework-RFCP-syllabus/edit/docusaurus/website',
47+
sidebarPath: './sidebars.ts',
4548
remarkPlugins: [remarkDirective, remarkTermDirective, [codeMaxLineLength, { max: 100 }]],
4649
},
4750
blog: false,
4851
theme: {
49-
customCss: require.resolve('./src/css/custom.css'),
52+
customCss: './src/css/custom.css',
5053
},
51-
}),
54+
} satisfies Preset.Options),
5255
],
5356
],
54-
themeConfig:
55-
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
56-
({
57-
colorMode: {
58-
defaultMode: 'dark',
59-
disableSwitch: false,
60-
respectPrefersColorScheme: false,
57+
themeConfig: ({
58+
colorMode: {
59+
defaultMode: 'dark',
60+
disableSwitch: false,
61+
respectPrefersColorScheme: true,
62+
},
63+
navbar: {
64+
title: 'RFCP-Syllabus',
65+
logo: {
66+
alt: 'Robot Framework Logo',
67+
src: 'img/robot-framework.svg',
68+
srcDark: 'img/robot-framework-dark.svg',
6169
},
62-
navbar: {
63-
title: 'RFCP-Syllabus',
64-
logo: {
65-
alt: 'Robot Framework Logo',
66-
src: 'img/robot-framework.svg',
67-
srcDark: 'img/robot-framework-dark.svg',
70+
items: [
71+
{
72+
type: 'doc',
73+
docId: 'overview',
74+
label: 'Introduction',
75+
position: 'left',
6876
},
69-
items: [
70-
{
71-
label: 'Introduction',
72-
to: '/docs/overview',
73-
position: 'left',
74-
},
75-
{
76-
label: 'Chapter 1',
77-
to: '/docs/chapter-01/overview',
78-
position: 'left',
79-
},
80-
{
81-
label: 'Chapter 2',
82-
to: '/docs/chapter-02/overview',
83-
position: 'left',
84-
},
85-
{
86-
label: 'Chapter 3',
87-
to: '/docs/chapter-03/overview',
88-
position: 'left',
89-
},
90-
{
91-
label: 'Chapter 4',
92-
to: '/docs/chapter-04/overview',
93-
position: 'left',
94-
},
95-
{
96-
label: 'Chapter 5',
97-
to: '/docs/chapter-05/overview',
98-
position: 'left',
99-
},
100-
{
101-
label: 'Example Exam',
102-
to: '/docs/example-exam',
103-
position: 'left',
104-
},
105-
{
106-
label: 'LOs',
107-
to: '/docs/learning_objectives',
108-
position: 'left',
109-
},
110-
],
111-
},
112-
footer: {
113-
style: 'dark',
114-
links: [
115-
],
116-
copyright: `Copyright © ${new Date().getFullYear()} Robot Framework® Foundation - Syllabus of Robot Framework® Certified Professional`,
117-
},
118-
prism: {
119-
theme: lightCodeTheme,
120-
darkTheme: darkCodeTheme,
121-
additionalLanguages: ['robotframework', 'python'],
122-
},
123-
}),
77+
{
78+
type: 'doc',
79+
docId: 'chapter-01/overview',
80+
label: 'Chapter 1',
81+
position: 'left',
82+
},
83+
{
84+
type: 'doc',
85+
docId: 'chapter-02/overview',
86+
label: 'Chapter 2',
87+
position: 'left',
88+
},
89+
{
90+
type: 'doc',
91+
docId: 'chapter-03/overview',
92+
label: 'Chapter 3',
93+
position: 'left',
94+
},
95+
{
96+
type: 'doc',
97+
docId: 'chapter-04/overview',
98+
label: 'Chapter 4',
99+
position: 'left',
100+
},
101+
{
102+
type: 'doc',
103+
docId: 'chapter-05/overview',
104+
label: 'Chapter 5',
105+
position: 'left',
106+
},
107+
{
108+
type: 'doc',
109+
docId: 'example-exam/Example-exam',
110+
label: 'Example Exam',
111+
position: 'left',
112+
},
113+
{
114+
type: 'doc',
115+
docId: 'learning_objectives',
116+
label: 'LOs',
117+
position: 'left',
118+
},
119+
{
120+
type: 'docsVersionDropdown',
121+
position: 'right',
122+
dropdownActiveClassDisabled: true,
123+
},
124+
],
125+
},
126+
footer: {
127+
style: 'dark',
128+
copyright: `Copyright © ${new Date().getFullYear()} Robot Framework® Foundation - Syllabus of Robot Framework® Certified Professional`,
129+
},
130+
prism: {
131+
theme: prismThemes.vsLight,
132+
darkTheme: prismThemes.dracula,
133+
additionalLanguages: ['robotframework', 'python'],
134+
},
135+
} satisfies Preset.ThemeConfig),
124136
plugins: [
125-
require.resolve('docusaurus-lunr-search')
137+
'docusaurus-lunr-search',
126138
],
127139
};
128140

129-
module.exports = config;
141+
export default config;

0 commit comments

Comments
 (0)