Skip to content

Commit aaa6928

Browse files
committed
Remove -SNAPSHOT from versions that are in tags
There were some errors in the releases which caused -SNAPSHOT to appear in released versions. This commit adds an antora extension that: 1) Removes -SNAPSHOT from the version of any tags 2) Removes -SNAPSHOT from asciidoctor attributes that end in -version
1 parent 1d0f9a0 commit aaa6928

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

antora-playbook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ antora:
33
- require: '@springio/antora-extensions'
44
root_component_name: 'shell'
55
- require: '@springio/antora-extensions/asciinema-extension'
6+
- require: './lib/antora/version-fix.js'
67
site:
78
title: Spring Shell
89
url: https://docs.spring.io/spring-shell/reference

lib/antora/version-fix.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict'
2+
3+
module.exports.register = function () {
4+
const logger = this.getLogger('version-fix')
5+
this.once('contentAggregated', ({ contentAggregate }) => {
6+
contentAggregate.forEach((componentVersionBucket) => {
7+
logger.info(`tag=${componentVersionBucket.origins[0].tag} version=${componentVersionBucket.version}`)
8+
// if it is a tag and a -SNAPSHOT release
9+
if (componentVersionBucket.origins[0].tag && componentVersionBucket.prerelease === '-SNAPSHOT') {
10+
// remove prerelease: -SNAPSHOT so it appears as a release
11+
delete componentVersionBucket.prerelease
12+
// If asciidoctor attribute name ends with -version, then remove -SNAPSHOT suffix (if present)
13+
const attrs = componentVersionBucket.asciidoc.attributes
14+
for (const [name, value] of Object.entries(attrs)) {
15+
if (name.endsWith('-version') && value.endsWith('-SNAPSHOT')) {
16+
attrs[name] = value.split('-SNAPSHOT').shift()
17+
logger.info(`Changing asciidoctor attr ${name} from ${value} to ${attrs[name]}`)
18+
}
19+
}
20+
}
21+
})
22+
})
23+
}

0 commit comments

Comments
 (0)