Skip to content

Commit

Permalink
Minor fixes redocly
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattia Pennati committed Mar 14, 2024
1 parent 110ca4b commit 5bb0a9b
Show file tree
Hide file tree
Showing 6 changed files with 662 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ jobs:
- name: Docker build
run: docker build . --file Dockerfile --tag opendatamesh/${IMAGE_NAME}:${{ env.TAG_VERSION }}
- name: Docker push
run: docker push opendatamesh/${IMAGE_NAME}:${{ env.TAG_VERSION }}
run: docker push opendatamesh/${IMAGE_NAME}:${{ env.TAG_VERSION }}
#- name: Publish API doc --> it needs REAL env variables in order to work, fix it
# run: |
# ./generate-full-redoc-static-html.sh
# ./upload-redoc-static-html-to-github.sh ${{ env.TAG_VERSION }}
68 changes: 68 additions & 0 deletions azuredevops-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,75 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.3.RELEASE</version>
<configuration>
<wait>1000</wait>
<maxAttempts>180</maxAttempts>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>generate-doc</id>
<build>
<plugins>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>0.2</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<apiDocsUrl>http://localhost:9003/api/v1/up/executor/v3/api-docs</apiDocsUrl>
<outputFileName>openapi.json</outputFileName>
<outputDir>${project.build.directory}</outputDir>
</configuration>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>3.1.0</version>
<executions>
<execution>
<id>redoc-static-html-gen</id>
<phase>post-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/scripts/generate-redoc-static-html.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
4 changes: 4 additions & 0 deletions azuredevops-server/scripts/generate-redoc-static-html.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

redocly build-docs ./target/openapi.json --output redoc-static.html --theme.openapi.hideHostname
mv ./redoc-static.html ./target
38 changes: 38 additions & 0 deletions generate-full-redoc-static-html.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# TO DO: export real variables before executing this script
#export AZURE_TENANT_ID="<val>"
#export AZURE_ODM_APP_CLIENT_ID="<val>"
#export AZURE_ODM_APP_CLIENT_SECRET="<val>"

# Generate openapi.json and redoc-static.html for each module
mvn clean package spring-boot:repackage -DskipTests
mvn clean verify -DskipTests -Pgenerate-doc

# Create a directory for documentation
DOC_DIR="redocly-docs"

# Check if the doc directory already exists
if [ -d "$DOC_DIR" ]; then
# If it exists, remove it and create a new one
rm -rf "$DOC_DIR"
fi

# Create a new doc directory
mkdir "$DOC_DIR"

# Find all redoc-static.html files
REDOC_FILE="azuredevops-server/target/redoc-static.html"

# Check if any redoc-static.html files were found
if [ -z "$REDOC_FILE" ]; then
echo "No redoc-static.html file found in target directory."
exit 1
fi

# Copy and rename all redoc-static.html files to the aggregated documentation directory
NEW_NAME="${DOC_DIR}/executor-azuredevops-redoc-static.html"
cp "$REDOC_FILE" "$NEW_NAME"
echo "Renamed and copied $REDOC_FILE to $NEW_NAME"

echo "Documentation generated successfully in $DOC_DIR"
Loading

0 comments on commit 5bb0a9b

Please sign in to comment.