Generate antora.yml and push to spring-security-docs-generated

This commit is contained in:
Rob Winch 2021-08-20 17:08:39 -05:00
parent a0e9c67482
commit e4ce7249cc
3 changed files with 79 additions and 19 deletions

View File

@ -7,6 +7,7 @@ on:
env:
GH_TOKEN_DISPATCH: ${{ secrets.GH_TOKEN_DISPATCH }}
GH_TOKEN_PUSH: ${{ secrets.GH_TOKEN_PUSH }}
jobs:
build:
@ -14,5 +15,14 @@ jobs:
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Generate antora.yml
run: ./gradlew :spring-security-docs:generateAntora
- name: Push generated antora files to the spring-security-docs-generated
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: "spring-security/main" # The branch the action should deploy to.
folder: "docs/build/generateAntora" # The folder the action should deploy.
repository-name: "rwinch/spring-security-docs-generated"
token: ${{ secrets.GH_TOKEN_PUSH }}
- name: Dispatch Build Request
run: ${GITHUB_WORKSPACE}/.github/actions/dispatch.sh 'rwinch/spring-reference' "$GH_TOKEN_DISPATCH"
run: ${GITHUB_WORKSPACE}/.github/actions/dispatch.sh 'rwinch/spring-reference' "$GH_TOKEN_DISPATCH"

View File

@ -2,23 +2,6 @@ name: security
title: Spring Security
version: ~
display_version: 6.0
start_page: ROOT:overview/index.adoc
asciidoc:
attributes:
page-pagination: true
idprefix: ''
idseparator: '-'
apacheds-core-version: 1.5.5
gh-old-samples-url: https://github.com/spring-projects/spring-security/tree/5.4.x/samples
gh-samples-url: https://github.com/spring-projects/spring-security-samples/tree/main
gh-url: https://github.com/spring-projects/spring-security/tree/main
icondir: icons
security-api-url: https://docs.spring.io/spring-security/site/docs/current/api/
security-reference-url: https://docs.spring.io/spring-security/site/docs/reference/html5/
spring-core-version: 5.3.8
spring-framework-api-url: https://docs.spring.io/spring-framework/docs/current/javadoc-api/
spring-framework-reference-url: https://docs.spring.io/spring-framework/docs/current/reference/html/
spring-security-version: 6.0.0
unboundid-ldapsdk-version: 4.1
start_page: ROOT:index.adoc
nav:
- modules/ROOT/nav.adoc

View File

@ -0,0 +1,67 @@
apply plugin: 'java'
tasks.register("generateAntora") {
group = "Documentation"
description = "Generates the antora.yml for dynamic properties"
doLast {
def docsTag = snapshotBuild ? 'current' : project.version
def ghTag = snapshotBuild ? 'main' : project.version
def ghUrl = "https://github.com/spring-projects/spring-security/tree/$ghTag"
def ghOldSamplesUrl = "https://github.com/spring-projects/spring-security/tree/5.4.x/samples"
def ghSamplesUrl = "https://github.com/spring-projects/spring-security-samples/tree/$samplesBranch"
def securityDocsUrl = "https://docs.spring.io/spring-security/site/docs/$docsTag"
def securityApiUrl = "$securityDocsUrl/api/"
def securityReferenceUrl = "$securityDocsUrl/reference/html5/"
def springFrameworkApiUrl = "https://docs.spring.io/spring-framework/docs/$springFrameworkVersion/javadoc-api/"
def springFrameworkReferenceUrl = "https://docs.spring.io/spring-framework/docs/$springFrameworkVersion/reference/html/"
def versions = resolvedVersions(project.configurations.testRuntimeClasspath)
def ymlVersions = ""
versions.call().each { name, version ->
ymlVersions += """
${name}: ${version}"""
}
def outputFile = new File("$buildDir/generateAntora/antora.yml")
outputFile.getParentFile().mkdirs()
outputFile.createNewFile()
outputFile.setText("""name: security
title: Spring Security
version: ~
display_version: 6.0
start_page: ROOT:index.adoc
asciidoc:
attributes:
icondir: icons
gh-old-samples-url: $ghOldSamplesUrl
gh-samples-url: $ghSamplesUrl
gh-url: $ghUrl
security-api-url: $securityApiUrl
security-reference-url: $securityReferenceUrl
spring-framework-api-url: $springFrameworkApiUrl
spring-framework-reference-url: $springFrameworkReferenceUrl
spring-security-version: ${project.version}
${ymlVersions}
""")
}
}
dependencies {
testImplementation platform(project(":spring-security-dependencies"))
testImplementation "com.unboundid:unboundid-ldapsdk"
testImplementation "org.apache.directory.server:apacheds-core"
testImplementation "org.springframework:spring-core"
}
def resolvedVersions(Configuration configuration) {
return {
configuration.resolvedConfiguration
.resolvedArtifacts
.collectEntries { [(it.name + "-version"): it.moduleVersion.id.version] }
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
}