@@ -15,24 +15,31 @@ jobs:
1515 uses : actions/checkout@v4
1616 with :
1717 fetch-depth : 0
18+
1819 - name : Setup Node.js
1920 uses : actions/setup-node@v4
20-
21+
2122 - name : Install Redocly CLI
2223 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
2526 run : |
2627 git config --local user.email "[email protected] " 2728 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+
3440 - name : Build OpenAPI documentation
3541 run : |
42+
3643 cd specs/swagger
3744 echo "Building OpenAPI documentation..."
3845 redocly build-docs openapi.yaml --output=openapi.html
@@ -42,13 +49,14 @@ jobs:
4249 run : |
4350 git config --local user.email "[email protected] " 4451 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+
4755 if git diff --staged --quiet; then
4856 echo "No changes to commit"
4957 else
5058 git commit -m "Update OpenAPI documentation from main branch"
51- git push --force origin gh-pages
59+ git push origin gh-pages
5260 echo "Documentation pushed to gh-pages branch!"
5361 fi
5462 env :
0 commit comments