Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate reference documentation to Antora #3806

Merged
merged 26 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a482fbb
Migrate asciidoc files path to Antora structure, removed stylesheets/…
pderop May 2, 2024
2d340c0
Refactor ascidoc adoc files to Antora. core features and advenced fea…
pderop May 2, 2024
90e86ee
Add antora yml files.
pderop May 2, 2024
33be68a
Adapted gradle scripts to Antora.
pderop May 2, 2024
ad2a090
Build with JDK21 as current JDK
pderop May 2, 2024
2dc0570
Describe how to build the doc in README
pderop May 2, 2024
dfe2a21
Fixed comments for build-docs-zip
pderop May 7, 2024
8aff270
Applied feedback in README.md
pderop May 7, 2024
c6641fe
Removed distributed confusing prefix in README
pderop May 7, 2024
c1cefd8
Removed commented component_version attribute from antora-assembler.yml
pderop May 7, 2024
3f14206
Removed redundant empty lines
pderop May 7, 2024
05ebe58
Removed useless comment
pderop May 7, 2024
5c8b21e
Removed useless comment in docs/build.gradle
pderop May 7, 2024
34c854e
Only publish docs zip in reactor-core artifact. Fixed and clarified j…
pderop May 8, 2024
20f7d80
Exclude docs/build/** in nohttp part
pderop May 8, 2024
d3762ab
Log a friendly message when antora related tasks are used and when JD…
pderop May 15, 2024
75f03a8
Clarify TIP in aboutDocs.adoc
pderop May 15, 2024
1ba2fbf
Programmatically creating a sequence section does not render correctly
pderop May 15, 2024
b80c9d3
Corrected link to advanced features / null-safety
pderop May 15, 2024
b2f925c
Hide FIXME
pderop May 16, 2024
fad1622
Restructured levels in Exposing Reactor metrics chapter
pderop May 16, 2024
63d6661
Split appendices in separate documents
pderop May 16, 2024
8ea8863
Reorder links in apdx-operatorChoice.adoc
pderop May 16, 2024
9243ea5
Do not include Flux javadoc in the link
pderop May 16, 2024
bc98827
Do not include Flux javadoc in the link
pderop May 16, 2024
539a404
Added missing link
pderop May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 71 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
- main
- 3.6.x
permissions: read-all

env:
DOCS_ZIP: docs-zip
DOCS_ZIP_PATH: docs/build/distributions

jobs:
# General job notes: we DON'T want to cancel any previous runs, especially in the case of a "back to snapshots" build right after a release push
# We specify the ubuntu version to minimize the chances we have to deal with a migration during a release
Expand Down Expand Up @@ -63,11 +68,41 @@ jobs:
uses: gradle/actions/setup-gradle@e24011a3b5db78bd5ab798036042d9312002f252 # tag=v3
with:
arguments: ${{ matrix.test-type.arguments }}

# Build the docs-zip antora doc for the current branch, and upload generated docs-zip to workflow run.
# JDK21 is used because the antora plugin requires a JDK17 compatible version.
# Each deploy job can then download the docs-zip to ./docs/build/distributions/ in order to let it be included in published artifacts.
# (see gradle/setup.gradle publications which includes docs zip file, if found from docs/build/distributions directory)
build-docs-zip:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Set up Ruby for asciidoctor-pdf
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1
with:
ruby-version: 3.3.0
- name: Install asciidoctor-pdf / rouge
run: gem install asciidoctor-pdf rouge
- name: Setup java 21 for antora
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: 'temurin'
java-version: '21'
- name: Build antora docs zip distribution for the current branch
run: ./gradlew docs
- name: Upload docs/build to current workflow run
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
retention-days: 1
if-no-files-found: error

#deploy the snapshot artifacts to Artifactory
deploySnapshot:
name: deploySnapshot
runs-on: ubuntu-20.04
needs: prepare
needs: [prepare, build-docs-zip]
if: needs.prepare.outputs.versionType == 'SNAPSHOT'
environment: snapshots
steps:
Expand All @@ -94,6 +129,11 @@ jobs:
with:
distribution: 'temurin'
java-version: 8
- name: Download antora docs-zip
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
- name: deploy
env:
ORG_GRADLE_PROJECT_artifactory_publish_username: ${{secrets.ARTIFACTORY_SNAPSHOT_USERNAME}}
Expand All @@ -105,7 +145,7 @@ jobs:
deployMilestone:
name: deployMilestone
runs-on: ubuntu-20.04
needs: prepare
needs: [prepare, build-docs-zip]
if: needs.prepare.outputs.versionType == 'MILESTONE'
environment: releases
steps:
Expand All @@ -132,6 +172,11 @@ jobs:
with:
distribution: 'temurin'
java-version: 8
- name: Download antora docs-zip
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
- name: deploy
env:
ORG_GRADLE_PROJECT_artifactory_publish_username: ${{secrets.ARTIFACTORY_USERNAME}}
Expand All @@ -145,7 +190,7 @@ jobs:
deployRelease:
name: deployRelease
runs-on: ubuntu-20.04
needs: prepare
needs: [prepare, build-docs-zip]
if: needs.prepare.outputs.versionType == 'RELEASE'
environment: releases
steps:
Expand All @@ -172,6 +217,11 @@ jobs:
with:
distribution: 'temurin'
java-version: 8
- name: Download antora docs/build
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ${{ env.DOCS_ZIP }}
path: ${{ env.DOCS_ZIP_PATH }}
- name: deploy
env:
ORG_GRADLE_PROJECT_artifactory_publish_username: ${{secrets.ARTIFACTORY_USERNAME}}
Expand Down Expand Up @@ -213,5 +263,23 @@ jobs:
git tag -m "Release version ${{ needs.prepare.outputs.fullVersion }}" v${{ needs.prepare.outputs.fullVersion }} ${{ github.sha }}
git push --tags

cleanup:
name: Cleanup docs-zip artifact
needs: [ deploySnapshot, tagRelease, tagMilestone ]
if: always() # cleanup always run after all needed jobs, regardless of whether they were successful
runs-on: ubuntu-20.04
permissions:
actions: write
steps:
- name: delete antora docs-zip artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
ARTIFACTS_URL="/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts"
ARTIFACT_ID=$(gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' $ARTIFACTS_URL | jq -r '.artifacts[] | select(.name == "'$DOCS_ZIP'") | .id // ""')
if [ -n "$ARTIFACT_ID" ]; then
gh api --method DELETE -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' /repos/${{github.repository}}/actions/artifacts/$ARTIFACT_ID}
fi

# For Gradle configuration of signing, see https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
# publishMavenJavaPublicationToSonatypeRepository only sends to a staging repository
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ When the installations succeed, try to refresh the project and see that it build
The manual Operation-system specific JDK installation
is well explained in the [official docs](https://docs.oracle.com/en/java/javase/20/install/overview-jdk-installation.html)

### Building the doc

The current active shell JDK version must be compatible with JDK17 or higher for Antora to build successfully.
So, just ensure that you have installed JDK 21, as described above and make it as the current one.

Then you can build the antora documentation like this:
```shell
./gradlew docs
```

The documentation is generated in `docs/build/site/index.html` and in `docs/build/distributions/reactor-core-<version-docs.zip`

## Getting Started

New to Reactive Programming or bored of reading already ? Try the [Introduction to Reactor Core hands-on](https://github.com/reactor/lite-rx-api-hands-on) !
Expand Down
9 changes: 3 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ buildscript {
plugins {
alias(libs.plugins.artifactory)
alias(libs.plugins.shadow)
alias(libs.plugins.asciidoctor.convert) apply false
alias(libs.plugins.asciidoctor.pdf) apply false
alias(libs.plugins.japicmp)
alias(libs.plugins.download)
// note: build scan plugin now must be applied in settings.gradle
Expand All @@ -42,7 +40,6 @@ plugins {
}

apply plugin: "io.reactor.gradle.detect-ci"
apply from: "gradle/asciidoc.gradle" // asciidoc (which is generated from root dir)
apply from: "gradle/releaser.gradle"
apply from: "gradle/dependencies.gradle"
apply from: "gradle/toolchains.gradle"
Expand Down Expand Up @@ -89,7 +86,9 @@ ext {
}

nohttp {
source.exclude "docs/asciidoc/highlight/**"
source.exclude "docs/modules/ROOT/assets/highlight/**"
source.exclude "docs/.gradle/**"
source.exclude "docs/build/**"
source.exclude "**/build/reports/tests/**/*.html"
allowlistFile = project.file('codequality/nohttp/allowlist.lines')
}
Expand Down Expand Up @@ -201,8 +200,6 @@ configure(subprojects) { p ->
}
}

assemble.dependsOn docsZip

configure(subprojects) { p ->
// these apply once the above configure is done, but before project-specific build.gradle have applied
apply plugin: "io.reactor.gradle.java-conventions"
Expand Down
9 changes: 9 additions & 0 deletions docs/antora-assembler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root_level: 0
build:
publish: false
asciidoc:
build:
command: bundle exec asciidoctor-pdf -n -d book
attributes:
source-highlighter: rouge
pdf-theme: ./pdf-theme.yml
51 changes: 51 additions & 0 deletions docs/antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
antora:
extensions:
- '@springio/antora-extensions/partial-build-extension'
# atlas-extension must be before latest-version-extension so latest versions are applied to imported versions
- '@antora/atlas-extension'
- require: '@springio/antora-extensions/latest-version-extension'
- require: '@springio/antora-extensions/inject-collector-cache-config-extension'
- '@antora/collector-extension'
- id: pdf-extension # pdf-extension is enabled from antora-docs.gradle
require: '@antora/pdf-extension'
enabled: false
- require: '@springio/antora-extensions/root-component-extension'
root_component_name: 'reactor'
site:
title: Reactor Core Reference Guide
url: https://projectreactor.io/docs/core/release/reference
content:
sources:
- url: ./..
branches: HEAD
start_path: docs
worktrees: true
asciidoc:
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
attributes:
page-stackoverflow-url: https://stackoverflow.com/tags/project-reactor
page-pagination: ''
hide-uri-scheme: '@'
tabs-sync-option: '@'
chomp: 'all'
doctype: book
icons: font
toc2: true
sectnums: true
sectanchors: true
source-highlighter: highlightjs
highlightjsdir: modules/ROOT/assets/highlight
highlightjs-theme: railscasts
sourcemap: true
urls:
latest_version_segment: ''
runtime:
log:
failure_level: warn
format: pretty
ui:
bundle:
url: https://github.com/reactor/antora-ui-projectreactor/releases/download/latest/ui-bundle.zip
snapshot: true
24 changes: 24 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: reactor
version: true
title: Reactor 3 Reference Guide
start_page: aboutDoc.adoc
nav:
- modules/ROOT/nav.adoc
ext:
collector:
run:
command: gradlew -q "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :docs:generateAntoraResources
local: true
scan:
dir: ./build/generated-antora-resources

asciidoc:
attributes:
attribute-missing: 'warn'
chomp: 'all'
source-language: java
reactor-github-repo: 'https://github.com/reactor/reactor-core/tree/main'
javadoc: 'https://projectreactor.io/docs/core/{project-version}/api'
author:
- Stephane Maldini
- Simon Baslé