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

Fix deploy script handling of custom config file #402

Merged
merged 1 commit into from Oct 1, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Expand Up @@ -38,7 +38,8 @@
"yzhang.markdown-all-in-one",
"shakram02.bash-beautify",
"eamodio.gitlens",
"streetsidesoftware.code-spell-checker"
"streetsidesoftware.code-spell-checker",
"rogalmic.bash-debug"
],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip install --upgrade pip && pip install --user -r requirements.txt",
Expand Down
6 changes: 6 additions & 0 deletions .vscode/launch.json
Expand Up @@ -12,6 +12,12 @@
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Bash: Current File",
"type": "bashdb",
"request": "launch",
"program": "${file}",
},
{
"name": "Test: Build Mkdocs",
"type": "python",
Expand Down
3 changes: 2 additions & 1 deletion action.yml
Expand Up @@ -28,7 +28,7 @@
# # (optional) Specify a different theme [mkdocs|readthedocs|material]
# theme: material
# # (optional) Load a configuration file from a string
# config: "{additional_css: value}"
# config: "mkdocs.yml"
# # (optional) Version or alias. Specify multiple aliases with space
# # example: version: v0.1.0 latest
# version: latest
Expand Down Expand Up @@ -74,6 +74,7 @@ inputs:
config:
description: "Configuration file"
required: false
default: mkdocs.yml
version:
description: "Version to publish"
required: false
Expand Down
12 changes: 6 additions & 6 deletions docker/deploy.sh
@@ -1,18 +1,16 @@
#!/bin/bash

set -e

UNSET='\033[0m'
RED='\033[00;31m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
CYAN='\033[00;36m'


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

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

if [[ "${INPUT_PUSH}" == "1" || "${INPUT_PUSH,,}" == "true" ]]; then
git config --global user.name "${GITHUB_ACTOR}"
Expand All @@ -22,14 +20,16 @@ if [[ "${INPUT_PUSH}" == "1" || "${INPUT_PUSH,,}" == "true" ]]; then

if [ "${INPUT_VERSION}" ]; then
echo -e "${CYAN}Deploying ${INPUT_VERSION} to ${INPUT_PUBLISH_BRANCH}${UNSET}"
mike deploy -p -u -b ${INPUT_PUBLISH_BRANCH} ${INPUT_VERSION}
mike deploy --config-file ${INPUT_CONFIG} -p -u -b ${INPUT_PUBLISH_BRANCH} ${INPUT_VERSION}
else
echo -e "${CYAN}Deploying docs to ${INPUT_PUBLISH_BRANCH}${UNSET}"
mkdocs gh-deploy -b ${INPUT_PUBLISH_BRANCH}
mkdocs gh-deploy --config-file ${INPUT_CONFIG} -b ${INPUT_PUBLISH_BRANCH}
fi

if [ "${INPUT_DEFAULT_VERSION}" ]; then
echo -e "${CYAN}Setting default version to ${INPUT_DEFAULT_VERSION}${UNSET}"
mike set-default -p -b ${INPUT_PUBLISH_BRANCH} ${INPUT_DEFAULT_VERSION}
fi
else
mkdocs build --config-file ${INPUT_CONFIG}
fi