Skip to content

Commit

Permalink
stand back I am going todo ci.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-simons committed Feb 27, 2024
1 parent ef04370 commit b10f2bc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update GH-Pages."
- name: Push changes
uses: ad-m/[email protected]
with:
directory: target/gh-pages
branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<phase>prepare-package</phase>
<configuration>
<attributes>
<toc/>
<toc>left</toc>
</attributes>
</configuration>
</execution>
Expand Down
11 changes: 11 additions & 0 deletions etc/index.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Redirecting...</title>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; URL=/neo4j-jdbc/${current}/" />
</head>
<body>
<p>Please follow <a href="/neo4j-jdbc/${current}/">this link</a>.</p>
</body>
</html>

0 comments on commit b10f2bc

Please sign in to comment.