-
-
Notifications
You must be signed in to change notification settings - Fork 27
59 lines (54 loc) · 1.88 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
name: Build documentation
on:
push:
branches: [master]
jobs:
javadoc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Cache all the things
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build JavaDoc
run: mvn -B javadoc:javadoc -pl quartzlib --file pom.xml
- name: Checkout website repository
uses: actions/checkout@v2
with:
repository: zDevelopers/zdevelopers.github.io
path: web
branch: master
persist-credentials: false
- name: Push built documentation to website repository
shell: bash
run: |
# Extract project name
PROJECT_NAME=${GITHUB_REPOSITORY##*/}
PROJECT_NAME_LOWER=${PROJECT_NAME,,}
# Create dir if needed, cleanup old doc and copy new one
mkdir -p web/static/docs/
rm -rf web/static/docs/$PROJECT_NAME_LOWER
cp -r quartzlib/target/site/apidocs web/static/docs/$PROJECT_NAME_LOWER
# Go to website repository
cd web
# Configure git to push to this repository
git config --global user.name QuartzBot
git config --global user.email [email protected]
git config --global user.password ${{ secrets.QUARTZ_BOT_TOKEN }}
# Add files
echo ::group::Commit
git add .
git commit -m "Updated documentation for $PROJECT_NAME"
echo ::endgroup::
# Push
echo ::group::Push
git push https://QuartzBot:${{ secrets.QUARTZ_BOT_TOKEN }}@github.com/zDevelopers/zdevelopers.github.io.git
echo ::endgroup::