Skip to content

Commit 5fd9a84

Browse files
committed
Add build infrastructure for Antora site.
See #810
0 parents  commit 5fd9a84

File tree

12 files changed

+622
-0
lines changed

12 files changed

+622
-0
lines changed

.github/workflows/docs-build.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Antora Site
2+
run-name: ${{ format('{0} ({1})', github.workflow, github.event.inputs.build-refname || 'all') }}
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
build-refname:
7+
description: Enter git refname to build (e.g., 5.7.x).
8+
required: false
9+
permissions:
10+
contents: write
11+
jobs:
12+
build:
13+
if: github.repository_owner == 'spring-projects'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 5
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
- name: Setup Maven Action
26+
27+
with:
28+
java-version: 17
29+
- name: Set up refname build
30+
if: github.event.inputs.build-refname
31+
run: |
32+
git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }}
33+
export BUILD_REFNAME=${{ github.event.inputs.build-refname }}
34+
echo "BUILD_REFNAME=$BUILD_REFNAME" >> $GITHUB_ENV
35+
export BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:pom.xml | python3 -c "import xml.etree.ElementTree as xml; from sys import stdin; print(xml.parse(stdin).getroot().find('{http://maven.apache.org/POM/4.0.0}version').text)")
36+
echo BUILD_VERSION=$BUILD_VERSION >> $GITHUB_ENV
37+
- name: Cache nodejs
38+
uses: actions/cache@v3
39+
with:
40+
path: |
41+
node
42+
node_modules
43+
package.json
44+
package-lock.json
45+
key: ${{ runner.os }}-nodejs-${{ hashFiles('pom.xml') }}
46+
- name: Run Antora
47+
run: ./mvnw -B antora -Dantora.playbook=playbooks/${{ github.event.inputs.module }}.yml
48+
- name: Publish Docs
49+
uses: spring-io/spring-doc-actions/[email protected]
50+
with:
51+
docs-username: ${{ secrets.DOCS_USERNAME }}
52+
docs-host: ${{ secrets.DOCS_HOST }}
53+
docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }}
54+
docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }}
55+
site-path: target/antora/site
56+
- name: Bust Cloudflare Cache
57+
uses: spring-io/spring-doc-actions/[email protected]
58+
with:
59+
context-root: spring-vault
60+
cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
61+
cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.iml
2+
*.ipr
3+
*.iws
4+
*.crt
5+
*.hcl
6+
*.key
7+
.classpath
8+
.idea
9+
.project
10+
build
11+
target
12+
pom.xml.releaseBackup
13+
14+
node
15+
node_modules
16+
package.json
17+
package-lock.json

.mvn/wrapper/maven-wrapper.jar

48.3 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip

README.adoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
= Spring Vault Docs Build
2+
3+
You're currently viewing the Antora playbook branch.
4+
The playbook branch hosts the docs build that is used to build and publish the production docs site.
5+
6+
The Spring Vault reference docs are built using https://antora.org[Antora].
7+
This README covers how to build the docs in a software branch as well as how to build the production docs site locally.
8+
9+
== Building the Site
10+
11+
You can build the entire site by invoking the following on the docs-build branch and then viewing the site at `target/site/index.html`
12+
13+
[source,bash]
14+
----
15+
mvn antora
16+
----
17+
18+
== Building a Specific Branch
19+
20+
[source,bash]
21+
----
22+
mvn antora
23+
----

antora-playbook.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
antora:
2+
extensions:
3+
- '@springio/antora-extensions/partial-build-extension'
4+
- require: '@springio/antora-extensions/latest-version-extension'
5+
- require: '@springio/antora-extensions/inject-collector-cache-config-extension'
6+
- '@antora/collector-extension'
7+
- './antora/lib/version-fix.js'
8+
- '@antora/atlas-extension'
9+
- require: '@springio/antora-extensions/root-component-extension'
10+
root_component_name: 'vault'
11+
site:
12+
title: Spring Vault
13+
url: https://docs.spring.io/spring-vault/reference
14+
robots: allow
15+
git:
16+
ensure_git_suffix: false
17+
content:
18+
sources:
19+
- url: https://github.com/spring-projects/spring-vault
20+
# Refname matching:
21+
# https://docs.antora.org/antora/latest/playbook/content-refname-matching/
22+
branches: [ main,'({3..9}).+({1..9}).x', '!(3.0.x)' ]
23+
tags: [ '({3..9}).+({1..9}).+({0..9})?(-{RC,M}+({0..9}))' ]
24+
start_path: src/main/antora
25+
asciidoc:
26+
attributes:
27+
page-stackoverflow-url: https://stackoverflow.com/tags/spring-vault
28+
page-pagination: ''
29+
hide-uri-scheme: '@'
30+
tabs-sync-option: '@'
31+
extensions:
32+
- '@asciidoctor/tabs'
33+
- '@springio/asciidoctor-extensions'
34+
urls:
35+
latest_version_segment_strategy: redirect:to
36+
latest_version_segment: ''
37+
redirect_facility: httpd
38+
ui:
39+
bundle:
40+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.3/ui-bundle.zip
41+
snapshot: true
42+
runtime:
43+
log:
44+
failure_level: warn
45+
format: pretty

antora/lib/version-fix.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict'
2+
3+
/**
4+
* The purpose of this extension is to fix invalid metadata saved to either antora.yml or gradle.properties in certain
5+
* tags. This invalid metadata prevents Antora from classifying the component versions properly.
6+
*
7+
* This extension should be listed directly after @antora/collector-extension.
8+
*/
9+
module.exports.register = function () {
10+
this.once('contentAggregated', ({ contentAggregate }) => {
11+
contentAggregate.forEach((componentVersionBucket) => {
12+
if (componentVersionBucket.version === '3.2.0-SNAPSHOT') {
13+
componentVersionBucket.version = '3.2.0'
14+
componentVersionBucket.prerelease = '-SNAPSHOT'
15+
}
16+
})
17+
})
18+
}

0 commit comments

Comments
 (0)