Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some updates to the mkdocs publishing process #2888

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ jobs:
echo "${{ github.ref }}"
# Extract the version and if it is in `docs-v` form, strip that off the version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' -e 's/^docs-v//')
# Copy all of the root level md files into the docs folder for deployment, tweaking the relative paths
for i in *.md; do sed -e "s#docs/#./#g" $i >docs/$i; done
# Fix references in DevReadMe.md to moved files
sed -e "s#\.\./\.\./#../#" docs/features/DevReadMe.md >tmp.md; mv tmp.md docs/features/DevReadMe.md
# Fix image references in demo documents so they work in GitHub and mkdocs
for i in docs/demo/AriesOpenAPIDemo.md docs/demo/AliceGetsAPhone.md; do sed -e "s#src=.collateral#src=\"../collateral#" $i >$i.tmp; mv $i.tmp $i; done
# Run a script to prepare all the files that have to be moved/updated to publish cleanly
./scripts/prepmkdocs.sh
# Populate overrides for the current version, and then remove to not apply if VERSION is main branch
OVERRIDE=overrides/main.html
echo -e "{% extends \"base.html\" %}\n\n{% block outdated %}\n You are viewing the documentation for ACA-Py Release $VERSION.\n{% endblock %}" >$OVERRIDE
Expand Down
27 changes: 27 additions & 0 deletions scripts/prepmkdocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# A script to prep for testing of mkdocs generation, and then to clean up after
# Replicates the file preparation done in the .github/workflows/publish-docs Git Hub Action
# TODO: Move all the prepaanupCalled from the GHA to do all of the work being done there.
#
# Add argument "clean" to undo these changes when just being used for testing.
# WARNING -- does a `git checkout -- docs` so you will lose any others changes you make!!!

if [[ "$1" == "clean" ]]; then
rm -f docs/CHANGELOG.md \
docs/CODE_OF_CONDUCT.md \
docs/CONTRIBUTING.md \
docs/MAINTAINERS.md \
docs/PUBLISHING.md \
docs/SECURITY.md
git checkout -- docs
else
# Copy all of the root level md files into the docs folder for deployment, tweaking the relative paths
for i in *.md; do sed -e "s#docs/#./#g" $i >docs/$i; done
# Fix references in DevReadMe.md to moved files
sed -e "s#\.\./\.\./#../#" docs/features/DevReadMe.md >tmp.md; mv tmp.md docs/features/DevReadMe.md
# Fix image references in demo documents so they work in GitHub and mkdocs
for i in docs/demo/AriesOpenAPIDemo.md docs/demo/AliceGetsAPhone.md; do sed -e "s#src=.collateral#src=\"../collateral#" $i >$i.tmp; mv $i.tmp $i; done
# Cleanup indented bullets in at least the CHANGELOG.md so they look right when published
for i in docs/CHANGELOG.md; do sed -e 's#^ - # - #' $i >$i.tmp; mv $i.tmp $i; done
fi