-
-
Notifications
You must be signed in to change notification settings - Fork 11
97 lines (84 loc) · 3.16 KB
/
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
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
94
95
96
97
name: docs
on:
push:
branches: [ master ]
paths: [ '**.java', '.github/workflows/docs.yml' ]
pull_request:
branches: [ master ]
release:
types: [created]
workflow_dispatch:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Checkout the gh-pages branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: gh-pages
path: gh-pages
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Build docs with Maven
run: mvn compile javadoc:javadoc
- name: Copy to Documentation Website Location
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
run: |
rm -rf gh-pages/api
cp -rf target/reports/apidocs/. gh-pages/api
- name: Tidy up the javadocs
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
id: tidy
uses: cicirello/javadoc-cleanup@v1
with:
base-url-path: https://jpt.cicirello.org/
path-to-root: gh-pages
user-defined-block: |
<meta name="referrer" content="strict-origin-when-cross-origin">
<link rel="icon" href="/images/favicon.svg" sizes="any" type="image/svg+xml">
- name: Log javadoc-cleanup output
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
run: |
echo "modified-count = ${{ steps.tidy.outputs.modified-count }}"
- name: Commit documentation changes without pushing yet
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
run: |
cd gh-pages
if [[ `git status --porcelain` ]]; then
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "Automated API website updates."
fi
cd ..
- name: Generate the sitemap
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
id: sitemap
uses: cicirello/generate-sitemap@v1
with:
base-url-path: https://jpt.cicirello.org/
path-to-root: gh-pages
- name: Output stats
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
- name: Commit documentation website sitemap and push all commits
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
run: |
cd gh-pages
if [[ `git status --porcelain` ]]; then
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "Automated API website sitemap update."
fi
git push
cd ..