From 5728bde91c2133722fa3aa63f3b3eafbecde30b5 Mon Sep 17 00:00:00 2001 From: Andres Vazquez Date: Fri, 9 Sep 2022 11:39:21 -0300 Subject: [PATCH 1/2] Allow multiple cofig files for languages --- action.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/action.sh b/action.sh index f92ed95..27bf2ef 100755 --- a/action.sh +++ b/action.sh @@ -57,4 +57,34 @@ fi git remote rm origin git remote add origin "${remote_repo}" -mkdocs gh-deploy --config-file "${CONFIG_FILE}" --force +# Allow multiple config files (multi language) +# shellcheck disable=SC2153 +if [ -n "${CONFIG_FILES}" ]; then + + TOTAL=$(echo "$CONFIG_FILES" | wc -w) + # shellcheck disable=SC2206 + FILES=($CONFIG_FILES) + + for ((i = 1; i <= TOTAL; i++)) + do + + CONFIG_FILE="${GITHUB_WORKSPACE}/${FILES[$i-1]}" + + # First one is clean (not --dirty) + if [ "$i" -eq "0" ]; then + echo "BUILDING FIRST CONFIG: ${CONFIG_FILE}" + mkdocs build --config-file "${CONFIG_FILE}" + elif [ "$i" -eq "$TOTAL" ]; then + # last one includes a deploy + echo "BUILDING AND DEPLOY LAST CONFIG: ${CONFIG_FILE}" + mkdocs gh-deploy --config-file "${CONFIG_FILE}" --force --dirty + else + # intermediate single builds and are dirty + echo "BUILDING $i config file: ${CONFIG_FILE}" + mkdocs build --config-file "${CONFIG_FILE}" --dirty + fi + + done +else + mkdocs gh-deploy --config-file "${CONFIG_FILE}" +fi From 1cb4abfdccb229153ba5d6839ec529e57ce4b349 Mon Sep 17 00:00:00 2001 From: avdata99 Date: Mon, 19 Dec 2022 12:43:10 -0300 Subject: [PATCH 2/2] Fix action --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 27bf2ef..b9044ae 100755 --- a/action.sh +++ b/action.sh @@ -71,7 +71,7 @@ if [ -n "${CONFIG_FILES}" ]; then CONFIG_FILE="${GITHUB_WORKSPACE}/${FILES[$i-1]}" # First one is clean (not --dirty) - if [ "$i" -eq "0" ]; then + if [ "$i" -eq "1" ]; then echo "BUILDING FIRST CONFIG: ${CONFIG_FILE}" mkdocs build --config-file "${CONFIG_FILE}" elif [ "$i" -eq "$TOTAL" ]; then