From 0070f0224b621c6d97a5936c815fab7dc4972f91 Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 13:06:45 -0400 Subject: [PATCH 1/9] Allow for a custom path and domain at the same time Signed-off-by: Micha --- action.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/action.sh b/action.sh index 013a608..fe7599b 100755 --- a/action.sh +++ b/action.sh @@ -20,15 +20,18 @@ else fi fi -if [ -n "${CUSTOM_DOMAIN}" ]; then - print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/docs/CNAME" -fi - if [ -n "${CONFIG_FILE}" ]; then + if [ -n "${CUSTOM_DOMAIN}" ]; then + print_info "Setting custom domain for github pages" + echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/${CONFIG_FILE%\/*}/CNAME" + fi print_info "Setting custom path for mkdocs config yml" export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" else + if [ -n "${CUSTOM_DOMAIN}" ]; then + print_info "Setting custom domain for github pages" + echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/docs/CNAME" + fi export CONFIG_FILE="${GITHUB_WORKSPACE}/mkdocs.yml" fi From d9caebf6667e977fa62b914e1f2ef95faf131e08 Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 13:59:12 -0400 Subject: [PATCH 2/9] Fix CNAME issue when there's a custom config --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index fe7599b..886d4a7 100755 --- a/action.sh +++ b/action.sh @@ -23,7 +23,7 @@ fi if [ -n "${CONFIG_FILE}" ]; then if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/${CONFIG_FILE%\/*}/CNAME" + echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/CNAME" fi print_info "Setting custom path for mkdocs config yml" export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" From 62595411d7cf806d62ccc3fca84fefb1ad7f335d Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:16:05 -0400 Subject: [PATCH 3/9] Move check for custom domain under config variable --- action.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.sh b/action.sh index 886d4a7..1020d9c 100755 --- a/action.sh +++ b/action.sh @@ -21,12 +21,12 @@ else fi if [ -n "${CONFIG_FILE}" ]; then + print_info "Setting custom path for mkdocs config yml" + export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/CNAME" + echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/${CONFIG_FILE%\/*}/CNAME" fi - print_info "Setting custom path for mkdocs config yml" - export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" else if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" From a50ede85aeda368e9ff53d3cc1c01d155b10b77d Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:20:08 -0400 Subject: [PATCH 4/9] Remove extra slash --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 1020d9c..8b7e452 100755 --- a/action.sh +++ b/action.sh @@ -25,7 +25,7 @@ if [ -n "${CONFIG_FILE}" ]; then export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}/${CONFIG_FILE%\/*}/CNAME" + echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}${CONFIG_FILE%\/*}/CNAME" fi else if [ -n "${CUSTOM_DOMAIN}" ]; then From a3f5b39d60df56e87e779d07a70beb39fac2875c Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:21:30 -0400 Subject: [PATCH 5/9] Remove extra refrence to GITHUB_WORKSPACE --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 8b7e452..6dba2bb 100755 --- a/action.sh +++ b/action.sh @@ -25,7 +25,7 @@ if [ -n "${CONFIG_FILE}" ]; then export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${GITHUB_WORKSPACE}${CONFIG_FILE%\/*}/CNAME" + echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/CNAME" fi else if [ -n "${CUSTOM_DOMAIN}" ]; then From c1a817dcebfb5d1f0817107bb04d9c09875229c5 Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:27:50 -0400 Subject: [PATCH 6/9] Try adding site/ to CNAME path --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 6dba2bb..9333b0f 100755 --- a/action.sh +++ b/action.sh @@ -25,7 +25,7 @@ if [ -n "${CONFIG_FILE}" ]; then export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/CNAME" + echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/site/CNAME" fi else if [ -n "${CUSTOM_DOMAIN}" ]; then From 46a30448b054d9da65e14e44703be544f2f06a91 Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:30:07 -0400 Subject: [PATCH 7/9] Add some debug logging --- action.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 9333b0f..ff2ffcd 100755 --- a/action.sh +++ b/action.sh @@ -25,7 +25,9 @@ if [ -n "${CONFIG_FILE}" ]; then export CONFIG_FILE="${GITHUB_WORKSPACE}/${CONFIG_FILE}" if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages" - echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/site/CNAME" + echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/CNAME" + echo "${CONFIG_FILE%\/*}" + ls "${CONFIG_FILE%\/*}" fi else if [ -n "${CUSTOM_DOMAIN}" ]; then From 3a0ea60067398867970bb03f06380cdea9eaed7d Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:33:24 -0400 Subject: [PATCH 8/9] Add more debug logging --- action.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/action.sh b/action.sh index ff2ffcd..d151fa9 100755 --- a/action.sh +++ b/action.sh @@ -28,6 +28,7 @@ if [ -n "${CONFIG_FILE}" ]; then echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/CNAME" echo "${CONFIG_FILE%\/*}" ls "${CONFIG_FILE%\/*}" + ls "${GITHUB_WORKSPACE}/*" fi else if [ -n "${CUSTOM_DOMAIN}" ]; then From 3d411a02dccd87d322d9897da9a44e4072f43667 Mon Sep 17 00:00:00 2001 From: Micha Date: Sun, 23 Apr 2023 14:36:05 -0400 Subject: [PATCH 9/9] Fix the debug logging --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index d151fa9..dc81c28 100755 --- a/action.sh +++ b/action.sh @@ -28,7 +28,7 @@ if [ -n "${CONFIG_FILE}" ]; then echo "${CUSTOM_DOMAIN}" > "${CONFIG_FILE%\/*}/CNAME" echo "${CONFIG_FILE%\/*}" ls "${CONFIG_FILE%\/*}" - ls "${GITHUB_WORKSPACE}/*" + ls "${GITHUB_WORKSPACE}" fi else if [ -n "${CUSTOM_DOMAIN}" ]; then