Skip to content

Commit 700c84d

Browse files
committed
Add support for publishing commercial docs
1 parent 5d1e66c commit 700c84d

File tree

3 files changed

+87
-5
lines changed

3 files changed

+87
-5
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
build-and-deploy-docs:
1717
name: Build and Deploy Documentation
1818
if: github.repository_owner == 'spring-projects'
19-
runs-on: ubuntu-latest
19+
runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }}
2020
steps:
2121
- name: Check Out
2222
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525
- name: Fetch Main Branch
26-
run: git fetch origin main:main
26+
run: git fetch origin ${{ github.event.repository.default_branch }}:main
2727
- name: Set Up Node
2828
uses: actions/setup-node@v4
2929
with:
@@ -41,10 +41,15 @@ jobs:
4141
env:
4242
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
4343
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
44+
COMMERCIAL_REPO_USERNAME: ${{ secrets.COMMERCIAL_ARTIFACTORY_RO_USERNAME }}
45+
COMMERCIAL_REPO_PASSWORD: ${{ secrets.COMMERCIAL_ARTIFACTORY_RO_PASSWORD }}
46+
COMMERCIAL_SNAPSHOT_REPO_URL: ${{ vars.COMMERCIAL_SNAPSHOT_REPO_URL }}
47+
COMMERCIAL_RELEASE_REPO_URL: ${{ vars.COMMERCIAL_RELEASE_REPO_URL }}
4448
BUILD_REFNAME: ${{ github.event.inputs.build-refname }}
4549
BUILD_VERSION: ${{ github.event.inputs.build-version }}
4650
run: node run.js --no-checkout
47-
- name: Sync Documentation
51+
- name: Sync OSS Documentation
52+
if: ${{ !vars.COMMERCIAL }}
4853
uses: spring-io/spring-doc-actions/[email protected]
4954
with:
5055
docs-username: ${{ secrets.DOCS_USERNAME }}
@@ -55,13 +60,26 @@ jobs:
5560
env:
5661
BUILD_REFNAME: ${{ github.event.inputs.build-refname }}
5762
BUILD_VERSION: ${{ github.event.inputs.build-version }}
58-
- name: Bust Cloudflare Cache
63+
- name: Bust OSS Cloudflare Cache
64+
if: ${{ !vars.COMMERCIAL }}
5965
uses: spring-io/spring-doc-actions/[email protected]
6066
with:
6167
context-root: spring-boot
6268
context-path: /
6369
cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
6470
cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
71+
- name: Authenticate for commercial distribution
72+
if: ${{ vars.COMMERCIAL }}
73+
uses: 'google-github-actions/[email protected]'
74+
with:
75+
credentials_json: '${{ secrets.COMMERCIAL_DOCS_GCP_BUCKET_JSON }}'
76+
- name: Sync commercial Documentation
77+
if: ${{ vars.COMMERCIAL }}
78+
uses: 'google-github-actions/[email protected]'
79+
with:
80+
path: 'build/site'
81+
destination: '${{ vars.COMMERCIAL_DOCS_HOST }}/spring-boot'
82+
parent: false
6583
- name: Send Notification
6684
if: failure()
6785
uses: ./.github/actions/send-notification

antora-commercial-playbook.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
antora:
2+
extensions:
3+
- require: '@antora/atlas-extension'
4+
- require: '@springio/antora-extensions/latest-version-extension'
5+
- require: '@springio/antora-extensions/override-navigation-builder-extension'
6+
- require: '@springio/antora-extensions/partial-build-extension'
7+
- require: '@springio/antora-extensions/publish-docsearch-config-extension'
8+
- require: '@springio/antora-extensions/set-algolia-env-extension'
9+
- require: '@springio/antora-extensions/static-page-extension'
10+
- require: '@springio/antora-xref-extension'
11+
- require: '@springio/antora-zip-contents-collector-extension'
12+
version_file: gradle.properties
13+
on_missing_snapshot_zip: drop_content
14+
username: '${env.COMMERCIAL_REPO_USERNAME}'
15+
password: '${env.COMMERCIAL_REPO_PASSWORD}'
16+
locations:
17+
- url: ${env.COMMERCIAL_SNAPSHOT_REPO_URL}/org/springframework/boot/spring-boot-docs/${version}/spring-boot-docs-${version}-${name}-${classifier}.zip
18+
for-version-type: [snapshot]
19+
- url: ${env.COMMERCIAL_RELEASE_REPO_URL}/org/springframework/boot/spring-boot-docs/${version}/spring-boot-docs-${version}-${name}-${classifier}.zip
20+
for-version-type: [release]
21+
# The root component extension must be last!
22+
- require: '@springio/antora-extensions/root-component-extension'
23+
root_component_name: boot
24+
site:
25+
title: Spring Boot
26+
url: https://docs.spring.vmware.com/spring-boot
27+
robots: allow
28+
content:
29+
sources:
30+
- url: .
31+
branches:
32+
- '3.3.x'
33+
tags:
34+
- '3.3.{14..100}*'
35+
start_paths:
36+
- spring-boot-project/spring-boot-docs/src/docs/antora
37+
- spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora
38+
- spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora
39+
- spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora
40+
version: unspecified
41+
edit_url: ~
42+
asciidoc:
43+
sourcemap: true
44+
attributes:
45+
chomp: all
46+
hide-uri-scheme: '@'
47+
javadoc-location: xref:api:java/
48+
page-pagination: ''
49+
page-stackoverflow-url: https://stackoverflow.com/tags/spring-boot
50+
tabs-sync-option: '@'
51+
extensions:
52+
- '@asciidoctor/tabs'
53+
- '@springio/asciidoctor-extensions'
54+
- '@springio/asciidoctor-extensions/configuration-properties-extension'
55+
- '@springio/asciidoctor-extensions/javadoc-extension'
56+
- '@springio/asciidoctor-extensions/section-ids-extension'
57+
urls:
58+
latest_version_segment: ''
59+
latest_version_segment_strategy: redirect:to
60+
redirect_facility: httpd
61+
runtime:
62+
log:
63+
failure_level: warn

run.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
function run(skip) {
3636
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'))
3737
const uiBundleUrl = packageJson.config['ui-bundle-url'];
38-
const command = `npx antora antora-playbook.yml --stacktrace --ui-bundle-url ${uiBundleUrl}`
38+
const playbook = (process.env.COMMERCIAL_RELEASE_REPO_URL) ? 'antora-commercial-playbook.yml' : 'antora-playbook.yml'
39+
const command = `npx antora ${playbook} --stacktrace --ui-bundle-url ${uiBundleUrl}`
3940
if (uiBundleUrl.includes('/latest/')) {
4041
console.log('Refusing to run Antora with development build of UI')
4142
console.log(`$ ${command}`)

0 commit comments

Comments
 (0)