Skip to content

Commit

Permalink
build: Improve github hosted docs generation.
Browse files Browse the repository at this point in the history
Symlinks aren't allowed anymore since 2023-02-28, image directory was still off.
  • Loading branch information
michael-simons committed Mar 7, 2023
1 parent 3d479fd commit 787e2d0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ on:
branches:
- main
paths-ignore:
- 'README.adoc'
- '.all-contributorsrc'
- '.github/workflows/publish_docs.yml'
- 'README.adoc'
- 'CHANGELOG.md'
- 'bin/generate-site.sh'
- 'docs/antora.yml'
- 'etc/index.tpl'
pull_request:
paths-ignore:
- 'README.adoc'
- '.all-contributorsrc'
- '.github/workflows/publish_docs.yml'
- 'README.adoc'
- 'CHANGELOG.md'
- 'bin/generate-site.sh'
- 'docs/antora.yml'
- 'etc/index.tpl'

jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ jobs:
java-version: 17
- name: Run docs generation
run: ./bin/generate-site.sh target/gh-pages/${refName} ${refName}
- name: Create symlink
- name: Update index
if: (github.event_name == 'create' && github.event.ref_type == 'tag')
working-directory: ./target/gh-pages
run: ln -sfn ${refName} current
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: |
Expand Down
5 changes: 4 additions & 1 deletion bin/generate-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ SOURCE_BRANCH=$2
cd "$DIR"/..

# Generate the documentation
./mvnw --no-transfer-progress asciidoctor:process-asciidoc@generate-docs -pl :neo4j-migrations-parent -Dproject.build.docs="$TARGET_FOLDER" -Dproject.build.docs.branch="$SOURCE_BRANCH"
mkdir -p $TARGET_FOLDER/img
cp -pr docs/modules/ROOT/images/* $TARGET_FOLDER/img
./mvnw --no-transfer-progress asciidoctor:process-asciidoc@generate-docs -pl :neo4j-migrations-parent -Dproject.build.docs="$TARGET_FOLDER" -Dproject.build.docs.branch="$SOURCE_BRANCH" -DdocsImagesDir=img

# Generate the site
# The asciidoc extensions fails for some weird Ruby / JRuby errors on GitHub; test results modified as they depend on that module as well.
sed -i.bak -e '/<module>extensions\/neo4j-migrations-formats-adoc<\/module>/d' -e '/<module>neo4j-migrations-test-results<\/module>/d' pom.xml
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ The latter is handy when migrate at start is disabled or in case there are callb
<div class="videoblock">
<div class="content">
<video controls style="width: 100%;">
<source src="_images/quarkus-dev-ui.webm" type="video/webm">
<source src="img/quarkus-dev-ui.webm" type="video/webm">
</video>
</div>
</div>
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-migrations/${current}/" />
</head>
<body>
<p>Please follow <a href="/neo4j-migrations/${current}/">this link</a>.</p>
</body>
</html>
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
<covered-ratio-instructions>0.5</covered-ratio-instructions>
<cypher-dsl.version>2023.0.3</cypher-dsl.version>
<docker-maven-plugin.version>0.41.0</docker-maven-plugin.version>
<docsImagesDir>${basedir}/docs/modules/ROOT/images</docsImagesDir>
<error_prone_annotations.version>2.18.0</error_prone_annotations.version>
<exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
<graalvm.version>22.3.1</graalvm.version>
Expand Down Expand Up @@ -934,7 +935,7 @@
<setanchors/>
<idprefix/>
<idseparator/>
<imagesdir>${basedir}/docs/modules/ROOT/images</imagesdir>
<imagesdir>${docsImagesDir}</imagesdir>
<neo4j-java-driver-version>${neo4j-java-driver.version}</neo4j-java-driver-version>
<neo4j-migrations.version>${project.version}</neo4j-migrations.version>
<source-highlighter>coderay</source-highlighter>
Expand Down

0 comments on commit 787e2d0

Please sign in to comment.