Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ antora:
- require: '@springio/antora-extensions'
root_component_name: 'shell'
- require: '@springio/antora-extensions/asciinema-extension'
- require: './lib/antora/version-fix.js'
site:
title: Spring Shell
url: https://docs.spring.io/spring-shell/reference
Expand Down
23 changes: 23 additions & 0 deletions lib/antora/version-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict'

module.exports.register = function () {
const logger = this.getLogger('version-fix')
this.once('contentAggregated', ({ contentAggregate }) => {
contentAggregate.forEach((componentVersionBucket) => {
logger.info(`tag=${componentVersionBucket.origins[0].tag} version=${componentVersionBucket.version}`)
// if it is a tag and a -SNAPSHOT release
if (componentVersionBucket.origins[0].tag && componentVersionBucket.prerelease === '-SNAPSHOT') {
// remove prerelease: -SNAPSHOT so it appears as a release
delete componentVersionBucket.prerelease
// If asciidoctor attribute name ends with -version, then remove -SNAPSHOT suffix (if present)
const attrs = componentVersionBucket.asciidoc.attributes
for (const [name, value] of Object.entries(attrs)) {
if (name.endsWith('-version') && value.endsWith('-SNAPSHOT')) {
attrs[name] = value.split('-SNAPSHOT').shift()
logger.info(`Changing asciidoctor attr ${name} from ${value} to ${attrs[name]}`)
}
}
}
})
})
}