Skip to content

Commit 3387149

Browse files
mojavelinuxsjohnr
authored andcommitted
repurpose 5.6.x branch to provide local docs build
* remove unused workflows, scripts, and configuration (now handled by docs-build branch) * upgrade Antora to 3.1 (and Node.js to 16) * tune playbook settings * reconfigure docs build for local build only * add patch to support using linked worktree as Antora content source * remove Antora extensions not needed for local builds
1 parent 8b74bf9 commit 3387149

15 files changed

+93
-424
lines changed

.github/actions/algolia-config.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/actions/algolia-deploy.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/actions/algolia-docsearch-scraper.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/algolia-index.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/deploy-reference.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/package-lock.json
2+
/node_modules/

docs/antora-linked-worktree-patch.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use strict'
2+
3+
/* Copyright (c) 2002-2022 the original author or authors.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
const { promises: fsp } = require('fs')
18+
const ospath = require('path')
19+
20+
/**
21+
* Rewrites local content sources to support the use of linked worktrees.
22+
*
23+
* @author Dan Allen <[email protected]>
24+
*/
25+
module.exports.register = function () {
26+
this.once('playbookBuilt', async ({ playbook }) => {
27+
const expandPath = this.require('@antora/expand-path-helper')
28+
for (const contentSource of playbook.content.sources) {
29+
const { url, branches } = contentSource
30+
if (url.charAt() !== '.') continue
31+
const absdir = expandPath(url, { dot: playbook.dir })
32+
const gitfile = ospath.join(absdir, '.git')
33+
if (await fsp.stat(gitfile).then((stat) => !stat.isDirectory(), () => false)) {
34+
const worktreeGitdir = await fsp.readFile(gitfile, 'utf8')
35+
.then((contents) => contents.trimRight().substr(8))
36+
const worktreeBranch = await fsp.readFile(ospath.join(worktreeGitdir, 'HEAD'), 'utf8')
37+
.then((contents) => contents.trimRight().replace(/^ref: (?:refs\/heads\/)?/, ''))
38+
const reldir = ospath.relative(
39+
playbook.dir,
40+
await fsp.readFile(ospath.join(worktreeGitdir, 'commondir'), 'utf8')
41+
.then((contents) => {
42+
const gitdir = ospath.join(worktreeGitdir, contents.trimRight())
43+
return ospath.basename(gitdir) === '.git' ? ospath.dirname(gitdir) : gitdir
44+
})
45+
)
46+
contentSource.url = reldir ? `.${ospath.sep}${reldir}` : '.'
47+
if (!branches) continue
48+
contentSource.branches = (branches.constructor === Array ? branches : [branches])
49+
.map((pattern) => pattern.replaceAll('HEAD', worktreeBranch))
50+
}
51+
}
52+
})
53+
}

docs/antora-playbook.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/antora.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
'name': 'ROOT'
2-
'prerelease': '-SNAPSHOT'
3-
'version': '5.6.8'
1+
name: 'ROOT'
2+
version: '5.6.8'
3+
prerelease: '-SNAPSHOT'

0 commit comments

Comments
 (0)