Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publishing process for gh-pages for the time being. #529

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading