Add runner 2 and 3 documentations (#488)

Reviewed-on: https://gitea.com/gitea/docs/pulls/488
Reviewed-by: silverwind <[email protected]>
This commit is contained in:
Lunny Xiao
2026-08-07 21:02:26 +00:00
parent 7629c02a9a
commit 0c62ec4893
57 changed files with 5215 additions and 37 deletions
+30 -25
View File
@@ -169,6 +169,16 @@ const versions = {
},
};
// The runner docs keep one directory per release series
// (runner-docs_versioned_docs/version-<series>), so a series is labelled "3.x"
// and a patch release never touches this file. The list is the one docusaurus
// maintains, newest first.
const runnerVersions = require("./runner-docs_versions.json");
const runnerVersionLabel = (version) => `${version}.x`;
const runnerVersionPath = (version) =>
// no path for the latest series, its docs are served at /runner/
version === runnerVersions[0] ? "/runner/" : `/runner/${version}/`;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Gitea Documentation",
@@ -196,23 +206,25 @@ const config = {
id: "runner-docs",
path: "runner-docs",
routeBasePath: "runner",
//sidebarPath: './runner/sidebars.js',
// the "current" runner docs are only a stub that re-uses the main
// docs runner page and do not describe the development version
// correctly, so they are not published
includeCurrentVersion: false,
sidebarPath: require.resolve("./runner-sidebars.js"),
// the current runner docs describe the main branch of gitea/runner
includeCurrentVersion: true,
versions: {
"1.0.8": {
label: "1.0.8",
},
"0.2.11": {
path: "0.2.11",
label: "0.2.11",
current: {
path: "develop",
label: "develop",
banner: "unreleased",
},
...Object.fromEntries(
runnerVersions.map((version) => [
version,
{ label: runnerVersionLabel(version) },
]),
),
},
// no "path" for lastVersion, so the latest stable runner docs are
// the newest series has no "path", so the latest stable runner docs are
// served at /runner/ and links do not need updating on each release
lastVersion: "1.0.8",
lastVersion: runnerVersions[0],
editUrl: ({
versionDocsDirPath,
docPath,
@@ -226,16 +238,6 @@ const config = {
: `runner-docs_versioned_docs/version-${version}`
}/${docPath}`;
},
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
const { item } = args;
// Use the provided data to generate a custom sidebar slice
const sidebarItems = await defaultSidebarItemsGenerator(args);
if (item.dirName !== "usage") {
return sidebarItems;
} else {
return sortItemsByCategory(sidebarItems);
}
},
},
],
],
@@ -450,8 +452,11 @@ const config = {
label: "Runner Version",
position: "right",
items: [
{ to: "/runner/", label: "1.0.8" },
{ to: "/runner/0.2.11/", label: "0.2.11" },
{ to: "/runner/develop/", label: "develop" },
...runnerVersions.map((version) => ({
to: runnerVersionPath(version),
label: runnerVersionLabel(version),
})),
],
routerRgx: "/runner/",
classNames: "runner-dropdown",