From 46709b4bc8bf73c19644ad28a687c75dafe4e5a6 Mon Sep 17 00:00:00 2001 From: Allison Thackston Date: Sat, 1 Oct 2022 08:48:45 -0700 Subject: [PATCH] Fix deploy script handling of custom config file (#402) --- .devcontainer/devcontainer.json | 3 ++- .vscode/launch.json | 6 ++++++ action.yml | 3 ++- docker/deploy.sh | 12 ++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 72b028b2..00639357 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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", diff --git a/.vscode/launch.json b/.vscode/launch.json index b68d2fc5..d043372f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,6 +12,12 @@ "console": "integratedTerminal", "justMyCode": true }, + { + "name": "Bash: Current File", + "type": "bashdb", + "request": "launch", + "program": "${file}", + }, { "name": "Test: Build Mkdocs", "type": "python", diff --git a/action.yml b/action.yml index eb3695e4..dce7590e 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -74,6 +74,7 @@ inputs: config: description: "Configuration file" required: false + default: mkdocs.yml version: description: "Version to publish" required: false diff --git a/docker/deploy.sh b/docker/deploy.sh index 2c36d1b4..d2240269 100755 --- a/docker/deploy.sh +++ b/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}" @@ -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