Modify build for collector
This commit is contained in:
12
.github/actions/publish-docs.sh
vendored
12
.github/actions/publish-docs.sh
vendored
@@ -20,7 +20,7 @@ fi
|
||||
install -m 600 -D /dev/null "$SSH_PRIVATE_KEY_PATH"
|
||||
echo "$SSH_PRIVATE_KEY" > "$SSH_PRIVATE_KEY_PATH"
|
||||
echo "$SSH_KNOWN_HOST" > ~/.ssh/known_hosts
|
||||
RSYNC_OPTS='-avz --delete'
|
||||
RSYNC_OPTS='--dry-run -avz --delete'
|
||||
if [ -f .full-build ]; then
|
||||
unlink .full-build
|
||||
BUILD_REFNAME=
|
||||
@@ -30,11 +30,11 @@ fi
|
||||
RSYNC_OPTS="$RSYNC_OPTS$(find $FROM -mindepth 1 -maxdepth 1 -type d \! -name _ -printf ' --include /%P --include /%P/**') --exclude **"
|
||||
fi
|
||||
rsync $RSYNC_OPTS -e "ssh -i $SSH_PRIVATE_KEY_PATH" $FROM/ "$HOST:$HOST_PATH"
|
||||
if [ -z "$BUILD_REFNAME" ]; then
|
||||
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
|
||||
-H "Content-Type:application/json" -H "Authorization: Bearer $CLOUDFLARE_CACHE_TOKEN" \
|
||||
--data '{"files":["https://docs.spring.io/spring-security-kerberos"]}'
|
||||
fi
|
||||
# if [ -z "$BUILD_REFNAME" ]; then
|
||||
# curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
|
||||
# -H "Content-Type:application/json" -H "Authorization: Bearer $CLOUDFLARE_CACHE_TOKEN" \
|
||||
# --data '{"files":["https://docs.spring.io/spring-security-kerberos"]}'
|
||||
# fi
|
||||
)
|
||||
exit_code=$?
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ antora:
|
||||
# uncomment this option to save the migrated content to the worktree
|
||||
#save_result: true
|
||||
unwrap_example_block: always
|
||||
- require: ./lib/antora/extensions/publish-docsearch-config
|
||||
template_path: ./.github/actions/docsearch-config.json.hbs
|
||||
- require: '@springio/antora-extensions/publish-docsearch-config-extension'
|
||||
index_name: 'spring-security-kerberos-docs'
|
||||
root_component_name: 'security'
|
||||
|
||||
site:
|
||||
title: Spring Security Kerberos
|
||||
url: https://docs.spring.io/spring-security-kerberos/reference
|
||||
|
||||
16
build.gradle
16
build.gradle
@@ -3,20 +3,24 @@ plugins {
|
||||
id 'org.antora' version '1.0.0'
|
||||
}
|
||||
|
||||
node {
|
||||
version = '16.15.0'
|
||||
}
|
||||
|
||||
antora {
|
||||
version = '3.2.0-alpha.2'
|
||||
options = [clean: true, fetch: true, stacktrace: true]
|
||||
environment = [
|
||||
'ALGOLIA_API_KEY': '82c7ead946afbac3cf98c32446154691',
|
||||
'ALGOLIA_APP_ID': '244V8V9FGG',
|
||||
'ALGOLIA_INDEX_NAME': 'kerberos-docs'
|
||||
]
|
||||
// environment = [
|
||||
// 'ALGOLIA_API_KEY': '82c7ead946afbac3cf98c32446154691',
|
||||
// 'ALGOLIA_APP_ID': '244V8V9FGG',
|
||||
// 'ALGOLIA_INDEX_NAME': 'spring-security-kerberos-docs'
|
||||
// ]
|
||||
dependencies = [
|
||||
'@antora/atlas-extension': '1.0.0-alpha.1',
|
||||
'@antora/collector-extension': '1.0.0-alpha.3',
|
||||
'@asciidoctor/tabs': '1.0.0-beta.3',
|
||||
'@opendevise/antora-release-line-extension': '1.0.0',
|
||||
'@springio/antora-extensions': '1.0.0',
|
||||
'@springio/antora-extensions': '1.1.0',
|
||||
'@springio/asciidoctor-extensions': '1.0.0-alpha.8',
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ const TASK_NAME=':spring-security-kerberos-docs:generateAntora'
|
||||
* Set of tags that contain a collector config, but the antora command fails on GitHub Actions.
|
||||
*/
|
||||
const VERSIONS_TO_OVERRIDE = [
|
||||
'6.0.0-RC1'
|
||||
]
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const fsp = require('node:fs/promises')
|
||||
const ospath = require('node:path')
|
||||
|
||||
/**
|
||||
* An Antora extension that generates a config file that controls the behavior of the docsearch scraper.
|
||||
*
|
||||
* This extension generates a docsearch config file by evaluating a Handlebars template (e.g.,
|
||||
* .github/actions/docsearch-config.json.hbs). It then publishes the output file to the root of the site
|
||||
* (docsearch-config.json). The docsearch scraper will retrieve for the config file from the published site.
|
||||
*
|
||||
* This extension will only add entries for the latest version in each release line. Additionally, if the page-archived
|
||||
* or page-noindex attribute is defined in the document header of the page, that page will be excluded from the index.
|
||||
*/
|
||||
module.exports.register = function ({ config: { templatePath = './docsearch/config.json.hbs' } }) {
|
||||
const expandPath = this.require('@antora/expand-path-helper')
|
||||
const handlebars = this.require('handlebars').create()
|
||||
handlebars.registerHelper('eq', (a, b) => a === b)
|
||||
handlebars.registerHelper('and', (a, b) => a && b)
|
||||
|
||||
this.on('beforePublish', async ({ playbook, contentCatalog, siteCatalog }) => {
|
||||
templatePath = expandPath(templatePath, { dot: playbook.dir })
|
||||
const templateSrc = await fsp.readFile(templatePath, 'utf8')
|
||||
const templateBasename = ospath.basename(templatePath)
|
||||
const template = handlebars.compile(templateSrc, { noEscape: true, preventIndent: true, srcName: templateBasename })
|
||||
const latestVersions = contentCatalog.getComponentsSortedBy('name').reduce((accum, component) => {
|
||||
component.versions.forEach((version) => version.versionSegment !== undefined && accum.push(version))
|
||||
return accum
|
||||
}, [])
|
||||
const stopPages = contentCatalog.getPages((page) => {
|
||||
return page.out && ('page-archived' in page.asciidoc.attributes || 'page-noindex' in page.asciidoc.attributes)
|
||||
})
|
||||
const compiled = template({ latestVersions, site: playbook.site, stopPages })
|
||||
siteCatalog.addFile({ contents: Buffer.from(compiled), out: { path: 'docsearch-config.json' } })
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user