-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (58 loc) · 2.06 KB
/
doc.yml
File metadata and controls
67 lines (58 loc) · 2.06 KB
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
name: Documentation
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '*'
- '!*-test'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [ main ]
jobs:
generate_and_push_doc_for_openapi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Fetch all tags since Gradle project version is built upon SCM
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '23'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
gradle-version: '8.14'
cache-disabled: true
- name: Generate Markdown documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew openApiMarkdownGenerate
- name: Generate UML documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew openApiUmlGenerate
- name: Set Git identity
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
git config --global user.name "$GITHUB_ACTOR"
- name: Push generated documentation if needed
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
git fetch --prune
git pull --rebase --autostash
if [[ `git status --porcelain` ]]; then
git checkout -b api_documentation
git add doc/ openapi/plantuml/
git commit -m "chore(docs): Update generated documentation" \
-m "Co-authored-by: csmplatform <csmplatform@users.noreply.github.com>"
git push --set-upstream origin api_documentation
gh pr create -B main -H api_documentation --title 'Merge api_documentation into main' --body 'Created by Github action'
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}