From b10f2bcf2350ee06536eec62e672c7f0f92081b4 Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Tue, 27 Feb 2024 16:48:01 +0100 Subject: [PATCH] stand back I am going todo ci. --- .github/workflows/publish_docs.yml | 52 ++++++++++++++++++++++++++++++ docs/pom.xml | 2 +- etc/index.tpl | 11 +++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish_docs.yml create mode 100644 etc/index.tpl diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml new file mode 100644 index 00000000..4043d63b --- /dev/null +++ b/.github/workflows/publish_docs.yml @@ -0,0 +1,52 @@ +name: publish_docs + +on: + push: + branches: + - main + create: + tags: + - '*' + +jobs: + publish_docs: + if: github.event_name == 'push' || (github.event_name == 'create' && github.event.ref_type == 'tag') + runs-on: ubuntu-latest + steps: + - name: Prepare branch name + run: > + echo "refName=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: Checkout relevant branch + uses: actions/checkout@v4 + with: + ref: ${{ env.refName }} + - name: Checkout gh-pages + uses: actions/checkout@v4 + with: + ref: gh-pages + path: target/gh-pages + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 17 + - name: Run docs generation + run: > + ./mvnw clean resources:copy-resources@prepare-asciidoc resources:copy-resources@copy-classes asciidoctor:process-asciidoc@generate-html-docs -pl docs && + mv docs/target/generated-docs/index.html target/gh-pages/${refName}/ + - name: Update index + if: (github.event_name == 'create' && github.event.ref_type == 'tag') + run: sed -e "s/\${current}/${refName}/g" ./etc/index.tpl > ./target/gh-pages/index.html + - name: Commit to gh-pages + working-directory: ./target/gh-pages + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -m "Update GH-Pages." + - name: Push changes + uses: ad-m/github-push-action@v0.6.0 + with: + directory: target/gh-pages + branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/pom.xml b/docs/pom.xml index 5e0c93c1..d65d340d 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -188,7 +188,7 @@ prepare-package - + left diff --git a/etc/index.tpl b/etc/index.tpl new file mode 100644 index 00000000..c6cb14eb --- /dev/null +++ b/etc/index.tpl @@ -0,0 +1,11 @@ + + + + Redirecting... + + + + +

Please follow this link.

+ +