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

Add GitHub token support to documentation scripts #99

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ function help() {
echo "Options:"
echo " -h Usage help; this message."
echo " -u <url> Deployment URL of documentation (to ensure search works)"
echo " -t GitHub Token"
}

while getopts hu: option;do
case "${option}" in
h) help && exit 0;;
u) SITE_URL=${OPTARG};;
t) GH_TOKEN=${OPTARG};;
esac
done

Expand All @@ -40,7 +42,7 @@ DOC_DIR=$(dirname ${DOCS_DIR})

# Update the mkdocs.yml
echo "Building documentation in ${DOC_DIR}"
${SCRIPT_PATH}/update_mkdocs_yml.py ${SITE_URL} ${DOCS_DIR}
${SCRIPT_PATH}/update_mkdocs_yml.py ${SITE_URL} ${DOCS_DIR} ${GH_TOKEN}

# Preserve files if necessary (as mkdocs build --clean removes all files)
if [ -e .laminas-mkdoc-theme-preserve ]; then
Expand Down
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mkdir -p ${DOC_DIR}/html
)

# Build the documentation
${SCRIPT_PATH}/build.sh -u ${SITE_URL}
${SCRIPT_PATH}/build.sh -u ${SITE_URL} ${GH_TOKEN}

# Commit and push the documentation to gh-pages
(
Expand Down
2 changes: 1 addition & 1 deletion github-actions/docs/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ print_info "Cloning documentation theme"
git clone https://github.com/laminas/documentation-theme.git "${GITHUB_WORKSPACE}/documentation-theme"

print_info "Building documentation"
(cd "${GITHUB_WORKSPACE}" ; ./documentation-theme/build.sh -u "${site_url}")
(cd "${GITHUB_WORKSPACE}" ; ./documentation-theme/build.sh -u "${site_url}" -t "${DEPLOY_TOKEN}")

print_info "Deploying documentation"
remote_branch="${PUBLISH_BRANCH}"
Expand Down
1 change: 1 addition & 0 deletions update_mkdocs_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

site_url = sys.argv[1]
docs_dir = sys.argv[2]
token = sys.argv[3]

with open("mkdocs.yml") as f:
mkdocs = yaml.load(f, Loader=yaml.SafeLoader)
Expand Down