-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update deployment CD and CLI docs build (#212)
Update deploy to onto-ns CD workflow Retrieve SHA for proper file comparison. Update CLI docs generation CI job. Add bash script to auto-update the CLI docs. Update CLI documentation. Add mongo-express to compose.
- Loading branch information
Showing
6 changed files
with
171 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
{ | ||
typer --version > /dev/null 2>&1 | ||
} || { | ||
echo -e "\n❌ 'typer' is not installed." && | ||
echo -e "Please install it and the 'entities-service' CLI using:\n\n pip install .[cli]\n" && | ||
exit 1 | ||
} | ||
|
||
DOCS_PATH="docs/CLI.md" | ||
|
||
if [ ! -f ${DOCS_PATH} ]; then | ||
echo "CLI documentation file not found at ${DOCS_PATH}." | ||
exit 1 | ||
fi | ||
|
||
rm /tmp/CLI.md 2> /dev/null | ||
|
||
# Generate CLI documentation | ||
typer entities_service.cli.main utils docs --output /tmp/CLI.md > /dev/null | ||
until grep -q "# \`entities-service\`" /tmp/CLI.md; do | ||
typer entities_service.cli.main utils docs --output /tmp/CLI.md > /dev/null | ||
done | ||
|
||
diff --suppress-common-lines /tmp/CLI.md ${DOCS_PATH} > /dev/null 2>&1 | ||
|
||
ERROR_CODE=$? | ||
|
||
if [ ${ERROR_CODE} -eq 2 ]; then | ||
echo "❌ diff encountered an error." | ||
exit 2 | ||
elif [ ${ERROR_CODE} -eq 1 ]; then | ||
echo "✨ CLI documentation will be updated." | ||
echo "Diff:" | ||
diff --suppress-common-lines --color /tmp/CLI.md ${DOCS_PATH} | ||
mv -f /tmp/CLI.md ${DOCS_PATH} | ||
echo -e "\nNow commit the changes to the documentation file:\n\n git add ${DOCS_PATH}\n git commit -m 'Update CLI documentation'\n" | ||
elif [ ${ERROR_CODE} -eq 0 ]; then | ||
echo "👌 CLI documentation is up-to-date." | ||
else | ||
echo "❌ Unknown error." | ||
exit 3 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters