forked from eclipse-tractusx/item-relationship-service
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (110 loc) · 4.26 KB
/
publish-documentation.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Lint and Publish documentation
on:
workflow_dispatch: # Trigger manually
pull_request:
paths:
- 'docs/**'
push:
branches:
- main
paths:
- 'docs/**'
jobs:
lint-and-publish:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
mvn -f docs/pom.xml --batch-mode generate-resources
- name: Install Asciidoctor Reducer
run: |
sudo gem install asciidoctor-reducer
- name: Reduce docs
run: |
echo $LANG
locale
asciidoctor-reducer -o docs/target/adminguide.adoc docs/src/docs/administration/administration-guide.adoc
asciidoctor-reducer -o docs/target/arc42.adoc docs/src/docs/arc42/full.adoc
- name: Cache plantuml jar
uses: actions/cache@v4
with:
path: plantuml.jar
key: ${{ runner.os }}-file-${{ hashFiles('plantuml.jar') }}
- name: Download PlantUML jar
run: |
wget -O plantuml.jar https://sourceforge.net/projects/plantuml/files/plantuml.jar/download
- name: Place PlantUML jar in specific path
run: |
mv plantuml.jar docs/src/diagram-replacer/
- name: Extract PNG-Images with PlantUML and replace PlantUML Code inside docs with PNG-Images
working-directory: docs/src/diagram-replacer/
run: |
node extract.js
node replace.js
- name: Convert to Markdown
# currently only specified for adminguide + arc42
run: |
npx downdoc -o docs/target/generated-docs/adminguide.md docs/src/diagram-replacer/generated-adocs/adminguide.adoc
npx downdoc -o docs/target/generated-docs/arc42.md docs/src/diagram-replacer/generated-adocs/arc42.adoc
- name: MD files post-processing
working-directory: docs/src/post-processing/
run: |
export REPO=${GITHUB_REPOSITORY#*/}
node fix_headers.js
node fix_no_emphasis.js
node fix_https_links.js
node fix_relative_links.js https://$GITHUB_REPOSITORY_OWNER.github.io/$REPO/docs
- name: MD linting
run: |
npm install markdownlint-cli2
npx markdownlint-cli2 --config docs/.markdownlint.yaml docs/target/generated-docs/adminguide.md
npx markdownlint-cli2 --config docs/.markdownlint.yaml docs/target/generated-docs/arc42.md
- name: Move assets to target directory
run: |
mv docs/src/diagram-replacer/assets/ docs/target/generated-docs/assets/
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: swagger-ui
spec-file: docs/src/api/irs-api.yaml
- name: Update documentation on GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "./docs/target/generated-docs"
destination_dir: "docs"
- name: Deploy Swagger UI to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "swagger-ui"
destination_dir: "docs/swagger-ui"