Add support for publishing commercial docs

This commit is contained in:
Phillip Webb
2025-06-30 12:28:36 -07:00
parent 5d1e66cc90
commit 700c84d06a
3 changed files with 87 additions and 5 deletions
+22 -4
View File
@@ -16,14 +16,14 @@ jobs:
build-and-deploy-docs:
name: Build and Deploy Documentation
if: github.repository_owner == 'spring-projects'
runs-on: ubuntu-latest
runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }}
steps:
- name: Check Out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch Main Branch
run: git fetch origin main:main
run: git fetch origin ${{ github.event.repository.default_branch }}:main
- name: Set Up Node
uses: actions/setup-node@v4
with:
@@ -41,10 +41,15 @@ jobs:
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
COMMERCIAL_REPO_USERNAME: ${{ secrets.COMMERCIAL_ARTIFACTORY_RO_USERNAME }}
COMMERCIAL_REPO_PASSWORD: ${{ secrets.COMMERCIAL_ARTIFACTORY_RO_PASSWORD }}
COMMERCIAL_SNAPSHOT_REPO_URL: ${{ vars.COMMERCIAL_SNAPSHOT_REPO_URL }}
COMMERCIAL_RELEASE_REPO_URL: ${{ vars.COMMERCIAL_RELEASE_REPO_URL }}
BUILD_REFNAME: ${{ github.event.inputs.build-refname }}
BUILD_VERSION: ${{ github.event.inputs.build-version }}
run: node run.js --no-checkout
- name: Sync Documentation
- name: Sync OSS Documentation
if: ${{ !vars.COMMERCIAL }}
uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.20
with:
docs-username: ${{ secrets.DOCS_USERNAME }}
@@ -55,13 +60,26 @@ jobs:
env:
BUILD_REFNAME: ${{ github.event.inputs.build-refname }}
BUILD_VERSION: ${{ github.event.inputs.build-version }}
- name: Bust Cloudflare Cache
- name: Bust OSS Cloudflare Cache
if: ${{ !vars.COMMERCIAL }}
uses: spring-io/spring-doc-actions/bust-cloudflare-antora-cache@v0.0.20
with:
context-root: spring-boot
context-path: /
cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
- name: Authenticate for commercial distribution
if: ${{ vars.COMMERCIAL }}
uses: 'google-github-actions/auth@v2.1.0'
with:
credentials_json: '${{ secrets.COMMERCIAL_DOCS_GCP_BUCKET_JSON }}'
- name: Sync commercial Documentation
if: ${{ vars.COMMERCIAL }}
uses: 'google-github-actions/upload-cloud-storage@v2.1.0'
with:
path: 'build/site'
destination: '${{ vars.COMMERCIAL_DOCS_HOST }}/spring-boot'
parent: false
- name: Send Notification
if: failure()
uses: ./.github/actions/send-notification
+63
View File
@@ -0,0 +1,63 @@
antora:
extensions:
- require: '@antora/atlas-extension'
- require: '@springio/antora-extensions/latest-version-extension'
- require: '@springio/antora-extensions/override-navigation-builder-extension'
- require: '@springio/antora-extensions/partial-build-extension'
- require: '@springio/antora-extensions/publish-docsearch-config-extension'
- require: '@springio/antora-extensions/set-algolia-env-extension'
- require: '@springio/antora-extensions/static-page-extension'
- require: '@springio/antora-xref-extension'
- require: '@springio/antora-zip-contents-collector-extension'
version_file: gradle.properties
on_missing_snapshot_zip: drop_content
username: '${env.COMMERCIAL_REPO_USERNAME}'
password: '${env.COMMERCIAL_REPO_PASSWORD}'
locations:
- url: ${env.COMMERCIAL_SNAPSHOT_REPO_URL}/org/springframework/boot/spring-boot-docs/${version}/spring-boot-docs-${version}-${name}-${classifier}.zip
for-version-type: [snapshot]
- url: ${env.COMMERCIAL_RELEASE_REPO_URL}/org/springframework/boot/spring-boot-docs/${version}/spring-boot-docs-${version}-${name}-${classifier}.zip
for-version-type: [release]
# The root component extension must be last!
- require: '@springio/antora-extensions/root-component-extension'
root_component_name: boot
site:
title: Spring Boot
url: https://docs.spring.vmware.com/spring-boot
robots: allow
content:
sources:
- url: .
branches:
- '3.3.x'
tags:
- '3.3.{14..100}*'
start_paths:
- spring-boot-project/spring-boot-docs/src/docs/antora
- spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora
- spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora
- spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora
version: unspecified
edit_url: ~
asciidoc:
sourcemap: true
attributes:
chomp: all
hide-uri-scheme: '@'
javadoc-location: xref:api:java/
page-pagination: ''
page-stackoverflow-url: https://stackoverflow.com/tags/spring-boot
tabs-sync-option: '@'
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
- '@springio/asciidoctor-extensions/configuration-properties-extension'
- '@springio/asciidoctor-extensions/javadoc-extension'
- '@springio/asciidoctor-extensions/section-ids-extension'
urls:
latest_version_segment: ''
latest_version_segment_strategy: redirect:to
redirect_facility: httpd
runtime:
log:
failure_level: warn
+2 -1
View File
@@ -35,7 +35,8 @@
function run(skip) {
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'))
const uiBundleUrl = packageJson.config['ui-bundle-url'];
const command = `npx antora antora-playbook.yml --stacktrace --ui-bundle-url ${uiBundleUrl}`
const playbook = (process.env.COMMERCIAL_RELEASE_REPO_URL) ? 'antora-commercial-playbook.yml' : 'antora-playbook.yml'
const command = `npx antora ${playbook} --stacktrace --ui-bundle-url ${uiBundleUrl}`
if (uiBundleUrl.includes('/latest/')) {
console.log('Refusing to run Antora with development build of UI')
console.log(`$ ${command}`)