-
Notifications
You must be signed in to change notification settings - Fork 9
70 lines (62 loc) · 2.62 KB
/
automate_javadoc.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
# SPDX-FileCopyrightText: 2022 2023 RTE FRANCE
#
# SPDX-License-Identifier: Apache-2.0
name: Continuous Deployment - JavaDocs
on:
pull_request_target:
types: [ labeled, closed ]
jobs:
build:
if: ${{ github.event.pull_request.base.ref == 'develop' && github.actor != 'dependabot[bot]' && github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'javadoc') }}
name: Java Docs
runs-on: ubuntu-latest
env:
DEPLOYMENT_BRANCH: gh-pages
DEPENDABOT_BRANCH: dependabot/javadoc-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.number }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v22
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Configure Git
run: |
git config --global user.name '${{ secrets.CONFIG_CI_USER_NAME }}'
git config --global user.email '${{ secrets.CONFIG_CI_USER_EMAIL }}'
git config pull.rebase false
git fetch origin ${{ env.DEPLOYMENT_BRANCH }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_BOT}}
git_user_signingkey: true
git_commit_gpgsign: true
# Take note that your GitHub Pages site is currently being built from the /docs folder in the DEPLOYMENT_BRANCH branch.
- name: Prepare Pull Request branch & commit files
run: |
mvn -s custom_maven_settings.xml clean javadoc:aggregate -P javadoc
mkdir -p docs/javadoc
yes | cp -Rf target/site/apidocs/* docs/javadoc/
git checkout -b temp
git add docs/javadoc/
git commit -m "[dependabot/javadoc/temp]: update javadoc"
git checkout ${{ env.DEPLOYMENT_BRANCH }}
git clean -fdx
git checkout -b ${{ env.DEPENDABOT_BRANCH }}
git cherry-pick -n -X theirs temp
git commit -m "[dependabot/javadoc]: update javadoc"
git checkout ${{ env.DEPLOYMENT_BRANCH }}
git merge ${{ env.DEPENDABOT_BRANCH }}
- name: Push Git Branch
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.DEPLOYMENT_BRANCH }}