diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..1435fc21 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,33 @@ +name: Deploy Docs +on: + push: + branches-ignore: [ gh-pages ] + tags: '**' + repository_dispatch: + types: request-build-reference # legacy + #schedule: + #- cron: '0 10 * * *' # Once per day at 10am UTC + workflow_dispatch: +permissions: + actions: write +jobs: + build: + runs-on: ubuntu-latest + # FIXME enable when pushed to spring-projects + # if: github.repository_owner == 'spring-projects' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: docs-build + fetch-depth: 1 + - name: Dispatch (partial build) + if: github.ref_type == 'branch' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }} + - name: Dispatch (full build) + if: github.ref_type == 'tag' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) diff --git a/antora.yml b/antora.yml new file mode 100644 index 00000000..aee5c215 --- /dev/null +++ b/antora.yml @@ -0,0 +1,19 @@ +name: ldap +version: true +title: Spring LDAP +nav: + - modules/ROOT/nav.adoc +ext: + collector: + run: + command: gradlew -q -PbuildSrc.skipTests=true "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" generateAntoraYml + local: true + scan: + dir: ./build/generated-antora-resources + +asciidoc: + attributes: + attribute-missing: 'warn' + # FIXME: the copyright is not removed + # FIXME: The package is not renamed + chomp: 'all' \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1a4f9167..4b801219 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,11 @@ buildscript { } } +plugins { + id 'io.spring.antora.generate-antora-yml' version '0.0.1' + id 'org.antora' version '1.0.0' +} + apply plugin: 'io.spring.convention.root' apply plugin: 'io.spring.convention.docs' apply plugin: 'io.spring.javaformat' @@ -32,26 +37,27 @@ nohttp { source.exclude "buildSrc/build/**" } -asciidoctor { - outputDir = new File("$buildDir/docs") - attributes([ - copycss : '', - icons : 'font', - 'source-highlighter': 'prettify', - sectanchors : '', - toc2: '', - idprefix: '', - idseparator: '-', - doctype: 'book', - numbered: '', - 'spring-ldap-version' : project.version, - revnumber : project.version - ]) - options = [ - eruby: 'erubis' - ] + +antora { + playbook = 'cached-antora-playbook.yml' + playbookProvider { + repository = 'spring-projects/spring-ldap' + branch = 'docs-build' + path = 'lib/antora/templates/per-branch-antora-playbook.yml' + checkLocalBranch = true + } + options = [clean: true, fetch: !project.gradle.startParameter.offline, stacktrace: true] } + + +tasks.named("generateAntoraYml") { + asciidocAttributes = project.provider( { + return ['project-version': project.version] + } ) +} + + s101 { configurationDirectory = project.file("etc/s101") } @@ -60,7 +66,7 @@ allprojects { if (!['spring-ldap-bom', 'spring-security-docs'].contains(project.name)) { apply plugin: 'io.spring.javaformat' apply plugin: 'checkstyle' - + pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin -> configure(plugin) { dependencies { diff --git a/cached-antora-playbook.yml b/cached-antora-playbook.yml new file mode 100644 index 00000000..154f6132 --- /dev/null +++ b/cached-antora-playbook.yml @@ -0,0 +1,39 @@ +# PACKAGES antora@3.2.0-alpha.2 @antora/atlas-extension:1.0.0-alpha.1 @antora/collector-extension@1.0.0-alpha.3 @springio/antora-extensions@1.3.0 @asciidoctor/tabs@1.0.0-beta.3 @springio/asciidoctor-extensions @opendevise/antora-release-line-extension@1.0.0 +# +# The purpose of this Antora playbook is to build the docs in the current branch. +antora: + extensions: + - '@antora/collector-extension' + - id: '@antora/atlas-extension' + require: '@antora/atlas-extension' + enabled: false + - '@springio/antora-extensions/latest-version-extension' + - require: '@springio/antora-extensions/root-component-extension' + root_component_name: 'ldap' +site: + title: Spring LDAP Reference +content: + sources: + - url: . + branches: HEAD + worktrees: true +asciidoc: + attributes: + hide-uri-scheme: '@' + page-pagination: '' + primary-site-url: https://docs.spring.io/spring-ldap/reference + tabs-sync-option: '@' + extensions: + - '@asciidoctor/tabs' + - '@springio/asciidoctor-extensions' + - '@springio/asciidoctor-extensions/include-code-extension' + sourcemap: true +urls: + latest_version_segment: '' +runtime: + log: + failure_level: warn +ui: + bundle: + url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip + snapshot: true