@redpanda-data/docs-extensions-and-macros
Advanced tools
Comparing version 3.7.4 to 3.8.0
@@ -57,3 +57,3 @@ 'use strict'; | ||
if (uniqueRelatedDocs.length > 0 || uniqueRelatedLabs.length > 0) { | ||
logger.info(`Set related docs and labs attributes for ${labPage.asciidoc.doctitle}`); | ||
logger.debug(`Set related docs and labs attributes for ${labPage.asciidoc.doctitle}`); | ||
} | ||
@@ -60,0 +60,0 @@ }); |
@@ -22,3 +22,3 @@ 'use strict'; | ||
docPage.asciidoc.attributes['page-related-labs'] = JSON.stringify(relatedLabs) | ||
logger.info(`Set page-related-labs attribute for ${docPage.asciidoc.doctitle} to ${docPage.asciidoc.attributes['page-related-labs']}`) | ||
logger.debug(`Set page-related-labs attribute for ${docPage.asciidoc.doctitle} to ${docPage.asciidoc.attributes['page-related-labs']}`) | ||
}) | ||
@@ -25,0 +25,0 @@ }) |
@@ -40,5 +40,8 @@ 'use strict'; | ||
const consoleVersion = useTagAttributes | ||
? sanitizeAttributeValue(attributes['latest-console-tag'] || '') | ||
: sanitizeAttributeValue(attributes['latest-console-version'] || ''); | ||
const consoleVersion = isPrerelease | ||
? sanitizeAttributeValue(attributes['console-beta-tag'] || '') | ||
: (useTagAttributes | ||
? sanitizeAttributeValue(attributes['latest-console-tag'] || '') | ||
: sanitizeAttributeValue(attributes['latest-console-version'] || '')); | ||
const redpandaRepo = isPrerelease ? 'redpanda-unstable' : 'redpanda'; | ||
@@ -45,0 +48,0 @@ const consoleRepo = 'console'; |
module.exports = async (github, owner, repo) => { | ||
const semver = require('semver'); | ||
try { | ||
// Fetch all the releases from the repository | ||
const releases = await github.rest.repos.listReleases({ | ||
@@ -11,3 +12,3 @@ owner, | ||
// Filter tags with valid semver format | ||
// Filter valid semver tags and sort them to find the highest version | ||
const sortedReleases = releases.data | ||
@@ -19,12 +20,18 @@ .map(release => release.tag_name) | ||
if (sortedReleases.length > 0) { | ||
// Return the highest version with "v" prefix | ||
return sortedReleases[0]; | ||
// Find the highest versions for stable and beta releases | ||
const latestStableReleaseVersion = sortedReleases.find(tag => !tag.includes('-beta')); | ||
const latestBetaReleaseVersion = sortedReleases.find(tag => tag.includes('-beta')); | ||
return { | ||
latestStableRelease: latestStableReleaseVersion || null, | ||
latestBetaRelease: latestBetaReleaseVersion || null | ||
}; | ||
} else { | ||
console.log("No valid semver releases found."); | ||
return null; | ||
return { latestStableRelease: null, latestBetaRelease: null }; | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
return null; | ||
console.error('Failed to fetch release information:', error); | ||
return { latestStableRelease: null, latestBetaRelease: null }; | ||
} | ||
}; |
@@ -72,3 +72,3 @@ 'use strict'; | ||
if (latestVersions.console) { | ||
setVersionAndTagAttributes(asciidoc, 'latest-console', latestVersions.console, name, version); | ||
setVersionAndTagAttributes(asciidoc, 'latest-console', latestVersions.console.latestStableRelease, name, version); | ||
} | ||
@@ -81,2 +81,3 @@ if (latestVersions.connect) { | ||
setVersionAndTagAttributes(asciidoc, 'redpanda-beta', latestVersions.redpanda.latestRcRelease.version, name, version) | ||
setVersionAndTagAttributes(asciidoc, 'console-beta', latestVersions.console.latestBetaRelease, name, version); | ||
asciidoc.attributes['redpanda-beta-commit'] = latestVersions.redpanda.latestRcRelease.commitHash; | ||
@@ -96,3 +97,2 @@ } | ||
component.latest.asciidoc.attributes['latest-release-commit'] = latestVersions.redpanda.latestRedpandaRelease.commitHash; | ||
logger.info(`Updated Redpanda release version to ${latestVersions.redpanda.latestRedpandaRelease.version}`); | ||
} | ||
@@ -103,2 +103,9 @@ } | ||
console.log(chalk.green('Updated Redpanda documentation versions successfully.')); | ||
logger.info(`Latest Redpanda version: ${latestVersions.redpanda.latestRedpandaRelease.version}`); | ||
if (latestVersions.redpanda.latestRCRelease) logger.info(`Latest Redpanda beta version: ${latestVersions.redpanda.latestRCRelease.version}`); | ||
logger.info(`Latest Connect version: ${latestVersions.connect}`); | ||
logger.info(`Latest Console version: ${latestVersions.console.latestStableRelease}`); | ||
if (latestVersions.console.latestBetaRelease) logger.info(`Latest Console beta version: ${latestVersions.console.latestBetaRelease}`); | ||
logger.info(`Latest Redpanda Helm chart version: ${latestVersions.helmChart}`); | ||
logger.info(`Latest Operator version: ${latestVersions.operator}`); | ||
} catch (error) { | ||
@@ -117,5 +124,5 @@ logger.error(`Error updating versions: ${error}`); | ||
if (name && version) { | ||
logger.info(`Set ${baseName}-version to ${versionWithoutPrefix} and ${baseName}-tag to ${versionData} in ${name} ${version}`); | ||
logger.debug(`Set ${baseName}-version to ${versionWithoutPrefix} and ${baseName}-tag to ${versionData} in ${name} ${version}`); | ||
} else { | ||
logger.info(`Updated ${baseName}-version to ${versionWithoutPrefix} and ${baseName}-tag to ${versionData}`); | ||
logger.debug(`Updated ${baseName}-version to ${versionWithoutPrefix} and ${baseName}-tag to ${versionData}`); | ||
} | ||
@@ -122,0 +129,0 @@ } |
{ | ||
"name": "@redpanda-data/docs-extensions-and-macros", | ||
"version": "3.7.4", | ||
"version": "3.8.0", | ||
"description": "Antora extensions and macros developed for Redpanda documentation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
148173
2621