Skip to content

Commit fa97559

Browse files
committed
Update
1 parent 9479592 commit fa97559

4 files changed

Lines changed: 20 additions & 42 deletions

File tree

‎.github/workflows/manual_release_stable.yaml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
name: Version docs
107107
needs: [release_prepare, changelog_update, pypi_publish]
108108
runs-on: ubuntu-latest
109+
outputs:
110+
version_docs_commitish: ${{ steps.commit_versioned_docs.outputs.commit_long_sha }}
109111
permissions:
110112
contents: write
111113
env:
@@ -117,6 +119,7 @@ jobs:
117119
uses: actions/checkout@v6
118120
with:
119121
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
122+
ref: ${{ needs.changelog_update.outputs.changelog_commitish }}
120123

121124
- name: Set up Node
122125
uses: actions/setup-node@v6
@@ -158,6 +161,7 @@ jobs:
158161
npx docusaurus api:version "$MAJOR_MINOR"
159162
160163
- name: Commit and push versioned docs
164+
id: commit_versioned_docs
161165
uses: EndBug/add-and-commit@v9
162166
with:
163167
add: "website/versioned_docs website/versioned_sidebars website/versions.json"
@@ -173,8 +177,8 @@ jobs:
173177
id-token: write
174178
uses: ./.github/workflows/_release_docs.yaml
175179
with:
176-
# Use the default branch ref to include both changelog and versioned docs.
177-
ref: ${{ github.ref }}
180+
# Use the version_docs commit to include both changelog and versioned docs.
181+
ref: ${{ needs.version_docs.outputs.version_docs_commitish }}
178182
secrets: inherit
179183

180184
trigger_docker_build:

‎website/docusaurus.config.js‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,9 @@ const { join, resolve } = require('node:path');
33
const { config } = require('@apify/docs-theme');
44

55
const { externalLinkProcessor } = require('./tools/utils/externalLink');
6+
const { groupSort } = require('./transformDocs');
67
const versions = require('./versions.json');
78

8-
const GROUP_ORDER = [
9-
'Actor',
10-
'Charging',
11-
'Configuration',
12-
'Event data',
13-
'Event managers',
14-
'Events',
15-
'Request loaders',
16-
'Storage clients',
17-
'Storage data',
18-
'Storages',
19-
];
20-
21-
const groupSort = (g1, g2) => {
22-
if (GROUP_ORDER.includes(g1) && GROUP_ORDER.includes(g2)) {
23-
return GROUP_ORDER.indexOf(g1) - GROUP_ORDER.indexOf(g2);
24-
}
25-
return g1.localeCompare(g2);
26-
};
27-
289
const { absoluteUrl } = config;
2910

3011
/** @type {Partial<import('@docusaurus/types').DocusaurusConfig>} */

‎website/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useMemo } from 'react';
22
import { useVersions, useActiveDocContext, useDocsVersionCandidates } from '@docusaurus/plugin-content-docs/client';
33
import { useDocsPreferredVersion } from '@docusaurus/theme-common';
44
import { translate } from '@docusaurus/Translate';
@@ -9,18 +9,6 @@ import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
99

1010
const getVersionMainDoc = (version) => version.docs.find((doc) => doc.id === version.mainDocId);
1111

12-
function getApiLinks(props, pathname, baseUrl) {
13-
if (!pathname.startsWith(`${baseUrl}reference`)) {
14-
return [];
15-
}
16-
17-
try {
18-
return JSON.parse(props['data-api-links']);
19-
} catch {
20-
return [];
21-
}
22-
}
23-
2412
/* eslint-disable react/prop-types */
2513
export default function DocsVersionDropdownNavbarItem({
2614
mobile,
@@ -33,7 +21,16 @@ export default function DocsVersionDropdownNavbarItem({
3321
const { search, hash, pathname } = useLocation();
3422
const { siteConfig } = useDocusaurusContext();
3523
const baseUrl = siteConfig.baseUrl.endsWith('/') ? siteConfig.baseUrl : `${siteConfig.baseUrl}/`;
36-
const apiLinks = getApiLinks(props, pathname, baseUrl);
24+
const apiLinks = useMemo(() => {
25+
if (!pathname.startsWith(`${baseUrl}reference`)) {
26+
return [];
27+
}
28+
try {
29+
return JSON.parse(props['data-api-links']);
30+
} catch {
31+
return [];
32+
}
33+
}, [props['data-api-links'], pathname, baseUrl]);
3734

3835
const activeDocContext = useActiveDocContext(docsPluginId);
3936
const versions = useVersions(docsPluginId);

‎website/transformDocs.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,9 @@ function inferTypedocType(docspecType) {
140140

141141
// Sorts the groups of a Typedoc member, and sorts the children of each group
142142
function sortChildren(typedocMember) {
143+
const idToName = new Map(typedocMember.children.map(c => [c.id, c.name]));
143144
for (let group of typedocMember.groups) {
144-
group.children
145-
.sort((a, b) => {
146-
const firstName = typedocMember.children.find(x => x.id === a).name;
147-
const secondName = typedocMember.children.find(x => x.id === b).name;
148-
return firstName.localeCompare(secondName);
149-
});
145+
group.children.sort((a, b) => idToName.get(a).localeCompare(idToName.get(b)));
150146
}
151147
typedocMember.groups.sort((a, b) => groupSort(a.title, b.title));
152148
}

0 commit comments

Comments
 (0)