From 52523011f84009c790134159efb6c715206e10b7 Mon Sep 17 00:00:00 2001 From: Abel Salgado Romero Date: Wed, 21 Feb 2024 21:55:07 +0100 Subject: [PATCH] Fix gh-pages docs publication Found an issue where enabling 'antora' sub-modules causes commits with git-publish to be empty. For now simply remove antora module. * CI: * Set write permissions * Update active branches * Use GH Actions token * gh-pages Gradle script * Update active branches * Inject repo from CI env var * Update .sdkmanrc to Java 11 * Some documents fixes --- .github/workflows/{build.yml => build.yaml} | 0 .github/workflows/push-documentation.yml | 17 ++++++++++------- .sdkmanrc | 4 ++-- README.adoc | 9 +++++---- docs/antora/build.gradle | 2 +- docs/build.gradle | 4 +--- docs/gh-pages/build.gradle | 5 +++-- docs/gradle.properties | 4 +--- docs/settings.gradle | 5 +++-- docs/src/docs/asciidoc/index.adoc | 4 +++- docs/src/docs/asciidoc/parts/compatibility.adoc | 3 ++- 11 files changed, 31 insertions(+), 26 deletions(-) rename .github/workflows/{build.yml => build.yaml} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yaml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/build.yaml diff --git a/.github/workflows/push-documentation.yml b/.github/workflows/push-documentation.yml index 56831a966..62907150a 100644 --- a/.github/workflows/push-documentation.yml +++ b/.github/workflows/push-documentation.yml @@ -3,8 +3,11 @@ on: push: branches: - master + - development-4.x +permissions: + contents: write jobs: - check: + push-docs: runs-on: ubuntu-latest if: github.repository == 'asciidoctor/asciidoctor-gradle-plugin' steps: @@ -12,8 +15,8 @@ jobs: - uses: actions/setup-java@v4 with: java-version: 11 - distribution: zulu - - uses: gradle/gradle-build-action@v2 + distribution: temurin + - uses: gradle/actions/setup-gradle@v3 with: gradle-home-cache-cleanup: true - name: Combine documentation @@ -23,9 +26,9 @@ jobs: - name: Publish documentation env: CI_BRANCH: ${{ github.ref_name }} + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + GRGIT_USER: 'GH Action User' + GRGIT_PASS: ${{ secrets.GITHUB_TOKEN }} run: | cd docs - ./gradlew --console=plain --info :antora:publishDocs :gh-pages:publishDocs \ - -Dorg.ajoberstar.grgit.auth.username=${{ secrets.GITHUB_PUBLISH_USER }} \ - -Dorg.ajoberstar.grgit.auth.password=${{ secrets.GITHUB_PUBLISH_KEY }} \ - -Dorg.ajoberstar.grgit.auth.force=hardcoded + ./gradlew --console=plain :gh-pages:publishDocs --info --stacktrace diff --git a/.sdkmanrc b/.sdkmanrc index 81a24fadd..b8a16ed85 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,3 +1,3 @@ - # Enable auto-env through the sdkman_auto_env config +# Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below -java=8.0.302-open +java=11.0.22-tem diff --git a/README.adoc b/README.adoc index 12ec96d94..4810eb9de 100644 --- a/README.adoc +++ b/README.adoc @@ -4,7 +4,7 @@ Andres Almiray :version-published: 4.0.0-alpha.1 :asciidoc-url: http://asciidoc.org :asciidoctor-url: http://asciidoctor.org -:issues: https://github.com/asciidoctor/asciidoctor-maven-plugin/issues +:issues: https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues :gradle-url: http://gradle.org/ :asciidoctor-maven-plugin: https://github.com/asciidoctor/asciidoctor-maven-plugin :kotlindsl: https://github.com/gradle/kotlin-dsl[Gradle Kotlin DSL] @@ -20,7 +20,7 @@ Andres Almiray :plugin-name: Asciidoctor Gradle plugin :project-name: asciidoctor-gradle-plugin :project-full-path: asciidoctor/asciidoctor-gradle-plugin -:github-branch: development-4.x +:github-branch: master :linkattrs: ifndef::env-github[:icons: font] ifdef::env-github,env-browser[] @@ -44,10 +44,11 @@ endif::[] The {doctitle} is the official means of using {asciidoctor-url}[Asciidoctor] to convert all your {asciidoc-url}[AsciiDoc] documentation using {gradle-url}[Gradle]. -Documentation:: We are migrating our documentation to the new Asciidoctor Antora-based site when it is ready. In the meantime you can read a snapshot of the new documentation at {asciidoctor-development-docs}{github-branch} +Documentation:: We are migrating our documentation to the new Asciidoctor Antora-based site when it is ready. +In the meantime you can read a snapshot of the current documentation at {asciidoctor-development-docs}{github-branch} ifdef::env-github[] -Structure:: `master` now represents the code for the latest 3.x release of these plugins. +Structure:: `master` now represents the code for the latest 4.x release of these plugins. Development for 4.x is against the link:https://github.com/asciidoctor/asciidoctor-gradle-plugin/tree/development-4.x[{github-branch}] branch. PRs are preferably taking against this branch. The 3.x series of the plugin is now in maintenance only mode. diff --git a/docs/antora/build.gradle b/docs/antora/build.gradle index 344af7290..738def79d 100644 --- a/docs/antora/build.gradle +++ b/docs/antora/build.gradle @@ -4,7 +4,7 @@ plugins { ext { currentBranch = System.getenv('CI_BRANCH') ?: 'not-on-ci' - pushDocs = currentBranch.matches(~/^(master|development-3.x|maintenance-1.5|maintenance-1.6)$/) + pushDocs = currentBranch.matches(~/^master|development-.+|maintenance-.+$/) } gitPublish { diff --git a/docs/build.gradle b/docs/build.gradle index 04015387d..564a695fc 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -1,10 +1,8 @@ -import org.apache.tools.ant.filters.ReplaceTokens - plugins { id 'idea' id 'org.asciidoctor.jvm.convert' apply false id 'org.asciidoctor.editorconfig' apply false - id 'org.ajoberstar.git-publish' version '4.2.1' apply false + id 'org.ajoberstar.git-publish' version '4.2.2' apply false } repositories { diff --git a/docs/gh-pages/build.gradle b/docs/gh-pages/build.gradle index a99c14873..719bcaa78 100644 --- a/docs/gh-pages/build.gradle +++ b/docs/gh-pages/build.gradle @@ -1,4 +1,5 @@ plugins { + id 'base' id 'org.ajoberstar.git-publish' } @@ -8,8 +9,8 @@ ext { } gitPublish { - repoUri = gitHubRepoUri - branch = pagesBranch + repoUri = System.getenv('REPO_URL') ?: gitHubRepoUri + branch = 'gh-pages' contents { into currentBranch diff --git a/docs/gradle.properties b/docs/gradle.properties index 79f7bbd5c..c2f4a03fb 100644 --- a/docs/gradle.properties +++ b/docs/gradle.properties @@ -1,3 +1 @@ -antoraBranch=antora-pages -pagesBranch=gh-pages -gitHubRepoUri=https://github.com/asciidoctor/asciidoctor-gradle-plugin.git \ No newline at end of file +gitHubRepoUri=https://github.com/asciidoctor/asciidoctor-gradle-plugin.git diff --git a/docs/settings.gradle b/docs/settings.gradle index 3bcc9b040..12293e956 100644 --- a/docs/settings.gradle +++ b/docs/settings.gradle @@ -1,5 +1,6 @@ rootProject.name='asciidoctor-gradle-docs' includeBuild('..') -include 'antora' -include 'gh-pages' \ No newline at end of file +include 'gh-pages' +// Removes antora, causes issue with gh-pages and git-publish plugin. Causing commits to delete files. +// include 'antora' diff --git a/docs/src/docs/asciidoc/index.adoc b/docs/src/docs/asciidoc/index.adoc index a8b39ede8..526767f7e 100644 --- a/docs/src/docs/asciidoc/index.adoc +++ b/docs/src/docs/asciidoc/index.adoc @@ -9,7 +9,9 @@ endif::[] The {doctitle} is the official means of using {asciidoctor-url}[Asciidoctor] to convert all your {asciidoc-url}[AsciiDoc] documentation using {gradle-url}[Gradle]. -This started as a port of the {asciidoctor-maven-plugin} project founded by {lightguard} and relies on {asciidoctorj}[{asciidoctorj-name}] which was founded by {lordofthejars}. In fact the 1.5.x series of the {plugin-name} can still be considered a port. However with 2.x series came a complete departure with functionality far exceeding any lightweight markup plugins for any other build tool. With the 3.x serious allows for even more flexibility and options for the creation of a true DocuOps pipeline by bringing together Gradle as a powerful and generic build tool, and Asciidoctor as an agile and lightweight document generator. +This started as a port of the {asciidoctor-maven-plugin} project founded by {lightguard} and relies on {asciidoctorj}[{asciidoctorj-name}] which was founded by {lordofthejars}. +In fact the 1.5.x series of the {plugin-name} can still be considered a port. However, with 2.x series came a complete departure with functionality far exceeding any lightweight markup plugins for any other build tool. +With the 3.x serious allows for even more flexibility and options for the creation of a true DocuOps pipeline by bringing together Gradle as a powerful and generic build tool, and Asciidoctor as an agile and lightweight document generator. include::parts/compatibility.adoc[] diff --git a/docs/src/docs/asciidoc/parts/compatibility.adoc b/docs/src/docs/asciidoc/parts/compatibility.adoc index ca3b28719..0da929c7c 100644 --- a/docs/src/docs/asciidoc/parts/compatibility.adoc +++ b/docs/src/docs/asciidoc/parts/compatibility.adoc @@ -1,3 +1,4 @@ == Compatibility -This collection of plugins requires at least Gradle 4.9, JDK 8.0 and AsciidoctorJ 2.0.0 to run. If you need prior Gradle, JDK or {asciidoctorj-name} support please use a plugin from the 1.5.x or 1.6.x release series. +This collection of plugins requires at least Gradle 4.9, JDK 11.0 and AsciidoctorJ 2.0.0 to run. +If you need prior Gradle, JDK or {asciidoctorj-name} support please use a plugin from the 1.5.x or 1.6.x release series.