-
Notifications
You must be signed in to change notification settings - Fork 65
55 lines (53 loc) · 2.02 KB
/
publish_docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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: 21
- name: Run docs generation
run: >
./mvnw --no-transfer-progress install -pl neo4j-cypher-dsl-bom &&
./mvnw --no-transfer-progress asciidoctor:process-asciidoc@generate-docs -pl org.neo4j:neo4j-cypher-dsl-parent -Dproject.build.docs=target/gh-pages/${refName} -Duse-latest-version-for-docs=`[ $refName = "main" ] && echo "0" || echo "1"` &&
./mvnw --no-transfer-progress site -pl org.neo4j:neo4j-cypher-dsl-build-proc -pl org.neo4j:neo4j-cypher-dsl -am &&
rm -rf target/gh-pages/${refName}/project-info &&
mv neo4j-cypher-dsl/target/site target/gh-pages/${refName}/project-info
- 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 }}