Update exhibit

This commit is contained in:
2026-07-06 19:25:57 +10:00
parent 5ffd1346d6
commit e92ad04b7e
8 changed files with 3757 additions and 195 deletions
+59 -24
View File
@@ -1,48 +1,73 @@
@echo off
REM ============================================================
REM Newbury Exhibit -> Gitea uploader
REM Wipe-and-re-clone _deploy checkout, copy tree, commit, push.
REM Mirrors the newbury-nights deploy pattern.
REM _deploy checkout lives OUTSIDE the project (sibling folder)
REM so it can never copy into itself (no more nested copies).
REM Default HTTPS via DNS; auto-fallback to direct LAN.
REM ============================================================
setlocal enabledelayedexpansion
set GITEA_HOST=gitea.hideawaygaming.com.au
set LAN_URL=https://gitea.hideawaygaming.com.au
set OWNER=jessikitty
set REPO=newbury-exhibit
set BRANCH=dev
set SRC=%~dp0
REM SRC = this script's folder (the project). Strip trailing backslash.
set "SRC=%~dp0"
if "%SRC:~-1%"=="\" set "SRC=%SRC:~0,-1%"
REM DEPLOY = sibling folder next to the project, NOT inside it.
for %%I in ("%SRC%\..") do set "PARENT=%%~fI"
set "DEPLOY=%PARENT%\newbury-exhibit_deploy"
set HTTPS_REMOTE=https://%GITEA_HOST%/%OWNER%/%REPO%.git
set LAN_REMOTE=%LAN_URL%/%OWNER%/%REPO%.git
echo.
echo === Newbury Exhibit deploy ===
echo Source: %SRC%
echo Target: https://%GITEA_HOST%/%OWNER%/%REPO% (branch %BRANCH%)
echo Source: %SRC%
echo Checkout: %DEPLOY% (sibling - outside the project)
echo Target: %HTTPS_REMOTE% (branch %BRANCH%)
echo.
REM --- fresh _deploy checkout ---
if exist "%SRC%_deploy" (
echo Removing old _deploy checkout...
rmdir /s /q "%SRC%_deploy"
)
echo Cloning %BRANCH%...
git clone -b %BRANCH% "https://%GITEA_HOST%/%OWNER%/%REPO%.git" "%SRC%_deploy"
if errorlevel 1 (
echo ERROR: clone failed. Check credentials / branch exists.
pause & exit /b 1
REM --- ensure ghost roster is present (copy from NewburyNights if missing) ---
if not exist "%SRC%\data\ghosts.json" (
if exist "%PARENT%\NewburyNights\ghosts.enriched.json" (
echo Copying ghost roster into data\ghosts.json ...
copy /y "%PARENT%\NewburyNights\ghosts.enriched.json" "%SRC%\data\ghosts.json" >nul
)
)
REM --- auto-detect git identity from existing global config ---
REM --- fresh _deploy checkout (clone via HTTPS; fall back to LAN) ---
if exist "%DEPLOY%" (
echo Removing old checkout...
rmdir /s /q "%DEPLOY%"
)
echo Cloning %BRANCH% via HTTPS...
git clone -b %BRANCH% "%HTTPS_REMOTE%" "%DEPLOY%"
if errorlevel 1 (
echo HTTPS clone failed, trying direct LAN...
git clone -b %BRANCH% "%LAN_REMOTE%" "%DEPLOY%"
if errorlevel 1 ( echo ERROR: clone failed on both remotes. & pause & exit /b 1 )
)
REM --- git identity from global config ---
for /f "tokens=*" %%a in ('git config --global user.name') do set GITNAME=%%a
for /f "tokens=*" %%a in ('git config --global user.email') do set GITEMAIL=%%a
if "!GITNAME!"=="" set GITNAME=jessikitty
if "!GITEMAIL!"=="" set GITEMAIL=jess.rogerson.29@outlook.com
REM --- copy project files into checkout (exclude deploy/node_modules/git) ---
REM --- copy project into checkout. Source has no _deploy inside it now, ---
REM --- but still exclude the usual noise. .git in DEPLOY is protected. ---
echo Syncing files...
robocopy "%SRC%." "%SRC%_deploy" /E /XD "_deploy" "node_modules" ".git" /XF "*.log" >nul
robocopy "%SRC%" "%DEPLOY%" /MIR /XD "node_modules" ".git" "newbury-exhibit_deploy" "backups" /XF "*.log" ".run.pid" ".deploy-installed" >nul
pushd "%SRC%_deploy"
pushd "%DEPLOY%"
git config user.name "!GITNAME!"
git config user.email "!GITEMAIL!"
git config http.postBuffer 524288000
git config http.version HTTP/1.1
echo.
echo === Staged changes ===
@@ -56,11 +81,21 @@ if "!MSG!"=="" set MSG=Update exhibit
git commit -m "!MSG!"
if errorlevel 1 (
echo Nothing to commit, or commit failed.
) else (
git push origin %BRANCH%
if errorlevel 1 ( echo ERROR: push failed. & popd & pause & exit /b 1 )
echo.
echo === Pushed to %BRANCH% successfully ===
popd & pause & exit /b 0
)
echo.
echo Pushing via HTTPS...
git push origin %BRANCH%
if errorlevel 1 (
echo HTTPS push failed ^(proxy/500?^). Retrying direct LAN...
git push "%LAN_REMOTE%" %BRANCH%
if errorlevel 1 (
echo ERROR: push failed on both remotes. Commit saved in %DEPLOY%.
popd & pause & exit /b 1
)
)
echo.
echo === Pushed to %BRANCH% successfully ===
popd
pause