From f41221d571e812b99bc3130b96df3ac025f9622f Mon Sep 17 00:00:00 2001 From: nschimme <5505185+nschimme@users.noreply.github.com> Date: Tue, 12 May 2026 13:57:39 +0000 Subject: [PATCH 1/2] fix: correct sitemap.xml hostname and base path Updated scripts/ci-env.sh to correctly identify the mume.github.io repository and set the VITE_HOSTNAME to https://docs.mume.org. Also explicitly set VITE_BASE to / for the official production environment and improved CNAME reading by stripping whitespace. Updated .github/workflows/deploy.yml to prioritize VITE_BASE from the environment script and ensure no double-slashes are introduced when the base path is root. --- .github/workflows/deploy.yml | 2 +- scripts/ci-env.sh | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 818a9fd..3153d32 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -53,7 +53,7 @@ jobs: npm run build if [ -f CNAME ] && [ "${{ github.repository_owner }}" = "mume" ]; then cp CNAME dist/CNAME; fi env: - VITE_BASE: ${{ steps.pages.outputs.base_path }}/ + VITE_BASE: ${{ env.VITE_BASE || format('{0}/', steps.pages.outputs.base_path) }} - name: Collect PRs to deploy uses: actions/github-script@v9 diff --git a/scripts/ci-env.sh b/scripts/ci-env.sh index c280ee9..251e7ee 100755 --- a/scripts/ci-env.sh +++ b/scripts/ci-env.sh @@ -4,18 +4,19 @@ export VITE_LAST_UPDATED=$(git log -1 --format=%cd --date=format:'%B %Y') echo "VITE_LAST_UPDATED=$VITE_LAST_UPDATED" >> $GITHUB_ENV +OWNER="${GITHUB_REPOSITORY_OWNER:-mume}" +REPO=$(echo "${GITHUB_REPOSITORY:-${OWNER}/mume.github.io}" | cut -d'/' -f2) + # Set VITE_HOSTNAME from CNAME file if it exists -if [ -f CNAME ] && [ "$GITHUB_REPOSITORY_OWNER" = "mume" ]; then - export VITE_HOSTNAME="https://$(cat CNAME)" +if [ -f CNAME ] && [ "$OWNER" = "mume" ]; then + export VITE_HOSTNAME="https://$(cat CNAME | tr -d '[:space:]')" else # Fallback for PR previews if host/prefix are provided via env if [ -n "$PREVIEW_HOST" ]; then export VITE_HOSTNAME="https://${PREVIEW_HOST}${PREVIEW_PREFIX}" else # Fallback for forks or main repo without CNAME - OWNER="${GITHUB_REPOSITORY_OWNER:-mume}" - REPO=$(echo "${GITHUB_REPOSITORY:-${OWNER}/docs}" | cut -d'/' -f2) - if [ "$OWNER" = "mume" ] && [ "$REPO" = "docs" ]; then + if [ "$OWNER" = "mume" ] && [ "$REPO" = "mume.github.io" ]; then export VITE_HOSTNAME="https://docs.mume.org" elif [ "$REPO" = "$OWNER.github.io" ]; then export VITE_HOSTNAME="https://$OWNER.github.io" @@ -25,3 +26,9 @@ else fi fi echo "VITE_HOSTNAME=$VITE_HOSTNAME" >> $GITHUB_ENV + +# Explicitly set VITE_BASE=/ for the official production environment +if [ "$OWNER" = "mume" ] && [ "$REPO" = "mume.github.io" ]; then + export VITE_BASE="/" + echo "VITE_BASE=$VITE_BASE" >> $GITHUB_ENV +fi From e30f7925721a55eb81953ccce655c02b61baab0b Mon Sep 17 00:00:00 2001 From: nschimme <5505185+nschimme@users.noreply.github.com> Date: Tue, 12 May 2026 14:19:48 +0000 Subject: [PATCH 2/2] fix: correct sitemap.xml hostname and base path Updated scripts/ci-env.sh to correctly identify the mume.github.io repository and set the VITE_HOSTNAME to https://docs.mume.org. Used idiomatic shell patterns for reading CNAME and ensured consistent variable usage. Updated .github/workflows/deploy.yml to prioritize VITE_BASE from the environment script and ensure no double-slashes are introduced when the base path is root. --- scripts/ci-env.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci-env.sh b/scripts/ci-env.sh index 251e7ee..55e9544 100755 --- a/scripts/ci-env.sh +++ b/scripts/ci-env.sh @@ -9,7 +9,8 @@ REPO=$(echo "${GITHUB_REPOSITORY:-${OWNER}/mume.github.io}" | cut -d'/' -f2) # Set VITE_HOSTNAME from CNAME file if it exists if [ -f CNAME ] && [ "$OWNER" = "mume" ]; then - export VITE_HOSTNAME="https://$(cat CNAME | tr -d '[:space:]')" + CNAME_VAL=$(tr -d '[:space:]' < CNAME) + export VITE_HOSTNAME="https://$CNAME_VAL" else # Fallback for PR previews if host/prefix are provided via env if [ -n "$PREVIEW_HOST" ]; then