Skip to content

Commit

Permalink
feat: mkdocs deploy script (#364)
Browse files Browse the repository at this point in the history
* mkdocs: set the base_path for snippets relative to config_dir

* mkdocs: add script to deploy docs to pyslurm.github.io git dir
  • Loading branch information
tazend authored Dec 30, 2024
1 parent d0bc6a0 commit b3006ba
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ markdown_extensions:
- admonition
- pymdownx.snippets:
check_paths: true
base_path: !relative $config_dir
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
Expand Down
50 changes: 50 additions & 0 deletions scripts/deploy-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

usage() { echo "Usage: $0 -v version -p path-to-github-io-dir [-d] " 1>&2; exit 1; }

opt_version=""
opt_path_to_remote=""
opt_default='false'
script_dir=$(dirname -- "${BASH_SOURCE[0]}")
path_to_mkdocs_config="$(realpath -- "$script_dir";)/../mkdocs.yml"

while getopts ":v:p:d" o; do
case "${o}" in
v)
opt_version=${OPTARG}
;;
p)
opt_path_to_remote=${OPTARG}
;;
d)
opt_default='true'
;;
*)
usage
;;
esac
done

shift $((OPTIND-1))

if [[ -z "${opt_version}" ]]
then
echo "Error: -v is required"
usage
fi

if [[ -z "${opt_path_to_remote}" ]]
then
echo "Error: -p is required"
usage
fi

cd "$opt_path_to_remote"

if ${opt_default}
then
mike set-default -b main -F "$path_to_mkdocs_config" "$opt_version"
exit 0
fi

mike deploy -b main -F "$path_to_mkdocs_config" "$opt_version"

0 comments on commit b3006ba

Please sign in to comment.