Skip to content

Commit

Permalink
Make versioning of docs with mike optional in action (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
athackst committed Aug 5, 2022
1 parent f08ae71 commit b6f0db5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 0 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ inputs:
version:
description: "Version to publish"
required: false
default: "latest"
default_version:
description: "Default version"
required: false
default: "latest"
push:
description: "Push to remote"
required: false
Expand Down
24 changes: 16 additions & 8 deletions docker/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
#!/bin/bash

set -e

git config --global --add safe.directory /github/workspace

echo "Building docs"
mkdocs_simple_gen --config-file ${INPUT_CONFIG:-'mkdocs.yml'}
mkdocs build

git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
if [ "${INPUT_PUSH}" ]; then
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

git fetch origin ${INPUT_PUBLISH_BRANCH} --depth=1
git fetch origin ${INPUT_PUBLISH_BRANCH} --depth=1

if [ ${INPUT_PUSH} ]; then
mike deploy -p -u -b ${INPUT_PUBLISH_BRANCH} ${INPUT_VERSION}
echo "Deploying ${INPUT_VERSION} to ${INPUT_PUBLISH_BRANCH}"
if [ "${INPUT_VERSION}" ]; then
echo "Deploying ${INPUT_VERSION} to ${INPUT_PUBLISH_BRANCH}"
mike deploy -p -u -b ${INPUT_PUBLISH_BRANCH} ${INPUT_VERSION}
else
echo "Deploying docs to ${INPUT_PUBLISH_BRANCH}"
mkdocs gh-deploy -b ${INPUT_PUBLISH_BRANCH}
fi

if [ ${INPUT_DEFAULT_VERSION} ]; then
mike set-default -p -b ${INPUT_PUBLISH_BRANCH} ${INPUT_DEFAULT_VERSION}
if [ "${INPUT_DEFAULT_VERSION}" ]; then
echo "Setting default version to ${INPUT_DEFAULT_VERSION}"
mike set-default -p -b ${INPUT_PUBLISH_BRANCH} ${INPUT_DEFAULT_VERSION}

fi
fi

0 comments on commit b6f0db5

Please sign in to comment.