-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (78 loc) · 2.56 KB
/
update_documentation.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Update Documentation
on:
push:
branches: [ master ]
pull_request:
branches: [ master, develop ]
jobs:
build_documentation:
if: !contains(github.event.head_commit.message, '[maven-release-plugin]')
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build JavaDoc with Maven
run: |
mvn -B javadoc:javadoc "-Dnotimestamp=true" "-Dcheckstyle.skipExec=true"
mvn -B javadoc:jar "-Dcheckstyle.skipExec=true"
- name: Upload JavaDoc as HTML
uses: actions/upload-artifact@v3
with:
name: JavaDoc
path: ./target/site/apidocs
- name: Upload JavaDoc as JAR
uses: actions/upload-artifact@v3
with:
name: JavaDocJar
path: ./target/misim-javadoc.jar
push_documentation_to_gh-pages:
name: Push Documentation to gh-pages
if: github.event_name == 'push' && !contains(github.event.head_commit.message, '[maven-release-plugin]')
needs: build_documentation
runs-on: ubuntu-latest
steps:
- name: Download JavaDoc Artifact
uses: actions/download-artifact@v3
with:
name: JavaDoc
path: ~/docs/
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global committer.email "[email protected]"
git config --global committer.name "GitHub Documentation Publish Workflow"
git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global author.name "${GITHUB_ACTOR}"
- name: Checkout Files
run: |
git checkout gh-pages
git pull
cp -rpv ~/docs/. .
- name: Check for changes
run: |
if git diff --quiet; then
echo "CHANGES_EXIST=false" >> $GITHUB_ENV
else
echo "CHANGES_EXIST=true" >> $GITHUB_ENV
fi
echo "Changes exist: $CHANGES_EXIST"
- name: Commit Changes Files
if: env.CHANGES_EXIST == 'true'
run: |
git commit -a -m "Updated documentation" --allow-empty
- name: Push Changes
if: env.CHANGES_EXIST == 'true'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages