Skip to content

Mkdocs deploy script #364

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

Merged
merged 2 commits into from
Dec 30, 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
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"
Loading