From 8800819758aad784251bfa9f983eec856e2010ec Mon Sep 17 00:00:00 2001
From: ndr_brt <andrea.bertagnolli@gmail.com>
Date: Mon, 23 Sep 2024 13:51:08 +0200
Subject: [PATCH] docs: render also markdown for autodoc

---
 .github/actions/publish-autodoc/action.yml | 10 ++++++++--
 .github/workflows/verify-openapi.yml       |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.github/actions/publish-autodoc/action.yml b/.github/actions/publish-autodoc/action.yml
index 2c1bee3..43a5aec 100644
--- a/.github/actions/publish-autodoc/action.yml
+++ b/.github/actions/publish-autodoc/action.yml
@@ -25,9 +25,12 @@ runs:
     - name: Merge manifests
       shell: bash
       run: ./gradlew mergeManifests
-    - name: Render markdown
+    - name: Render html
       shell: bash
       run: ./gradlew doc2html
+    - name: Render markdown
+      shell: bash
+      run: ./gradlew doc2md
 
     - name: extract version
       shell: bash
@@ -37,12 +40,15 @@ runs:
       shell: bash
       run: |
         mkdir -p deploy/autodoc/${{ env.VERSION }}
+        cp build/*.json deploy/autodoc/${{ env.VERSION }}/autodoc.json
+        cp build/*.md deploy/autodoc/${{ env.VERSION }}/autodoc.md
         cp build/*.html deploy/autodoc/${{ env.VERSION }}/index.html
 
     - name: Render html for stable version
       shell: bash
       if: ${{ !endsWith( env.VERSION, '-SNAPSHOT') }}
-      run: cp deploy/autodoc/${{ env.VERSION }}/index.html deploy/autodoc/index.html
+      run: | 
+        cp deploy/autodoc/${{ env.VERSION }}/* deploy/autodoc/
 
     - name: Deploy to GitHub Pages
       uses: peaceiris/actions-gh-pages@v4
diff --git a/.github/workflows/verify-openapi.yml b/.github/workflows/verify-openapi.yml
index a8e2406..5a3792f 100644
--- a/.github/workflows/verify-openapi.yml
+++ b/.github/workflows/verify-openapi.yml
@@ -50,7 +50,7 @@ jobs:
           fi
 
           VERSION=$(cat $JSON_VERSION_FILE | jq '.[] | select(.maturity=="stable" or .maturity==null) | .version' | cut -d '"' -f 2)
-          ./gradlew -PapiVersion=$VERSION -PapiTitle="${{ matrix.apiGroup }}" -PapiDescription="REST API documentation for the ${{ matrix.apiGroup }}" :mergeApiSpec --input=resources/openapi/yaml/${{ matrix.apiGroup }} --output=${{ matrix.apiGroup }}-new.yaml -q
+          ./gradlew -PapiVersion=$VERSION -PapiTitle="${{ matrix.apiGroup }}" -PapiDescription="REST API documentation for the ${{ matrix.apiGroup }}" :mergeApiSpec --input=resources/openapi/yaml/${{ matrix.apiGroup }} --output=${{ matrix.apiGroup }}-new.yaml
           
           git show origin/gh-pages:openapi/${{ matrix.apiGroup }}/${{ matrix.apiGroup }}.yaml > ${{ matrix.apiGroup }}.yaml