@redpanda-data/docs-extensions-and-macros 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Fetch the latest release version from GitHub
|
|
2
1
|
const { Octokit } = require("@octokit/rest");
|
|
3
2
|
const { retry } = require("@octokit/plugin-retry");
|
|
3
|
+
const semver = require("semver");
|
|
4
4
|
const OctokitWithRetries = Octokit.plugin(retry);
|
|
5
5
|
const owner = 'redpanda-data';
|
|
6
6
|
const repo = 'console';
|
|
@@ -16,15 +16,31 @@ if (process.env.REDPANDA_GITHUB_TOKEN) {
|
|
|
16
16
|
|
|
17
17
|
const github = new OctokitWithRetries(githubOptions);
|
|
18
18
|
|
|
19
|
-
var latestConsoleReleaseVersion;
|
|
20
|
-
|
|
21
19
|
module.exports = async () => {
|
|
22
20
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Fetch the latest 10 releases
|
|
22
|
+
const releases = await github.rest.repos.listReleases({
|
|
23
|
+
owner,
|
|
24
|
+
repo,
|
|
25
|
+
per_page: 10,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Filter valid semver tags and sort them
|
|
29
|
+
const sortedReleases = releases.data
|
|
30
|
+
.map(release => release.tag_name.replace(/^v/, ''))
|
|
31
|
+
.filter(tag => semver.valid(tag))
|
|
32
|
+
// Sort in descending order to get the highest version first
|
|
33
|
+
.sort(semver.rcompare);
|
|
34
|
+
|
|
35
|
+
if (sortedReleases.length > 0) {
|
|
36
|
+
// Return the highest version
|
|
37
|
+
return sortedReleases[0];
|
|
38
|
+
} else {
|
|
39
|
+
console.log("No valid semver releases found.");
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
26
42
|
} catch (error) {
|
|
27
43
|
console.error(error);
|
|
28
44
|
return null;
|
|
29
45
|
}
|
|
30
|
-
};
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redpanda-data/docs-extensions-and-macros",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Antora extensions and macros developed for Redpanda documentation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antora",
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"./extensions/replace-attributes-in-attachments": "./extensions/replace-attributes-in-attachments.js",
|
|
33
33
|
"./extensions/add-global-attributes": "./extensions/add-global-attributes.js",
|
|
34
34
|
"./extensions/version-fetcher/set-latest-version": "./extensions/version-fetcher/set-latest-version.js",
|
|
35
|
+
"./extensions/validate-attributes": "./extensions/validate-attributes.js",
|
|
36
|
+
"./extensions/find-related-docs": "./extensions/find-related-docs.js",
|
|
37
|
+
"./extensions/find-related-labs": "./extensions/find-related-labs.js",
|
|
35
38
|
"./extensions/algolia-indexer/index": "./extensions/algolia-indexer/index.js",
|
|
36
39
|
"./extensions/aggregate-terms": "./extensions/aggregate-terms.js",
|
|
37
40
|
"./macros/glossary": "./macros/glossary.js",
|
|
@@ -58,7 +61,8 @@
|
|
|
58
61
|
"html-entities": "2.3",
|
|
59
62
|
"js-yaml": "^4.1.0",
|
|
60
63
|
"lodash": "^4.17.21",
|
|
61
|
-
"node-html-parser": "5.4.2-0"
|
|
64
|
+
"node-html-parser": "5.4.2-0",
|
|
65
|
+
"semver": "^7.6.0"
|
|
62
66
|
},
|
|
63
67
|
"devDependencies": {
|
|
64
68
|
"@antora/cli": "3.1.4",
|