@@ -15,24 +15,31 @@ jobs:
15
15
uses : actions/checkout@v4
16
16
with :
17
17
fetch-depth : 0
18
+
18
19
- name : Setup Node.js
19
20
uses : actions/setup-node@v4
20
-
21
+
21
22
- name : Install Redocly CLI
22
23
run : npm install -g @redocly/cli
23
-
24
- - name : Switch to gh-pages branch
24
+
25
+ - name : Switch to gh-pages and copy OpenAPI source
25
26
run : |
26
27
git config --local user.email "[email protected] "
27
28
git config --local user.name "GitHub Action"
28
- echo "Switching to gh-pages branch..."
29
- git checkout -b gh-pages
30
- git fetch origin gh-pages
31
- git pull --rebase origin gh-pages
32
- env :
33
- GITHUB_TOKEN : ${{ secrets.GH_SYSTEMSDT_TOKEN }}
29
+
30
+ mkdir tmp-api
31
+
32
+ cp specs/swagger/openapi.yaml tmp-api/
33
+
34
+ git checkout gh-pages
35
+
36
+ cp tmp-api/openapi.yaml specs/swagger/openapi.yaml
37
+
38
+ rm -rf /tmp-api
39
+
34
40
- name : Build OpenAPI documentation
35
41
run : |
42
+
36
43
cd specs/swagger
37
44
echo "Building OpenAPI documentation..."
38
45
redocly build-docs openapi.yaml --output=openapi.html
@@ -42,13 +49,14 @@ jobs:
42
49
run : |
43
50
git config --local user.email "[email protected] "
44
51
git config --local user.name "GitHub Action"
45
- echo "Committing and pushing documentation..."
46
- git add specs/swagger/openapi.html
52
+
53
+ git add specs/swagger/openapi.html specs/swagger/openapi.yaml
54
+
47
55
if git diff --staged --quiet; then
48
56
echo "No changes to commit"
49
57
else
50
58
git commit -m "Update OpenAPI documentation from main branch"
51
- git push --force origin gh-pages
59
+ git push origin gh-pages
52
60
echo "Documentation pushed to gh-pages branch!"
53
61
fi
54
62
env :
0 commit comments