Update exhibit
This commit is contained in:
+13
-38
@@ -1,42 +1,36 @@
|
|||||||
@echo off
|
@echo off
|
||||||
REM ============================================================
|
REM ============================================================
|
||||||
REM Newbury Exhibit -> Gitea uploader
|
REM Newbury Exhibit -> Gitea uploader
|
||||||
REM Default: HTTPS via DNS. Auto-fallback: direct LAN (bypasses nginx).
|
REM Wipe-and-re-clone _deploy checkout, copy tree, commit, push.
|
||||||
REM Clean re-clone of dev, copy tree, show status, commit, push.
|
REM Mirrors the newbury-nights deploy pattern.
|
||||||
REM ============================================================
|
REM ============================================================
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
set GITEA_HOST=gitea.hideawaygaming.com.au
|
set GITEA_HOST=gitea.hideawaygaming.com.au
|
||||||
set LAN_URL=http://10.0.0.55:3000
|
|
||||||
set OWNER=jessikitty
|
set OWNER=jessikitty
|
||||||
set REPO=newbury-exhibit
|
set REPO=newbury-exhibit
|
||||||
set BRANCH=dev
|
set BRANCH=dev
|
||||||
set SRC=%~dp0
|
set SRC=%~dp0
|
||||||
|
|
||||||
set HTTPS_REMOTE=https://%GITEA_HOST%/%OWNER%/%REPO%.git
|
|
||||||
set LAN_REMOTE=%LAN_URL%/%OWNER%/%REPO%.git
|
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo === Newbury Exhibit deploy ===
|
echo === Newbury Exhibit deploy ===
|
||||||
echo Source: %SRC%
|
echo Source: %SRC%
|
||||||
echo Target: %HTTPS_REMOTE% (branch %BRANCH%)
|
echo Target: https://%GITEA_HOST%/%OWNER%/%REPO% (branch %BRANCH%)
|
||||||
echo Fallback: %LAN_REMOTE%
|
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM --- fresh _deploy checkout (clone via HTTPS; fall back to LAN) ---
|
REM --- fresh _deploy checkout ---
|
||||||
if exist "%SRC%_deploy" (
|
if exist "%SRC%_deploy" (
|
||||||
echo Removing old _deploy checkout...
|
echo Removing old _deploy checkout...
|
||||||
rmdir /s /q "%SRC%_deploy"
|
rmdir /s /q "%SRC%_deploy"
|
||||||
)
|
)
|
||||||
echo Cloning %BRANCH% via HTTPS...
|
echo Cloning %BRANCH%...
|
||||||
git clone -b %BRANCH% "%HTTPS_REMOTE%" "%SRC%_deploy"
|
git clone -b %BRANCH% "https://%GITEA_HOST%/%OWNER%/%REPO%.git" "%SRC%_deploy"
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo HTTPS clone failed, trying direct LAN...
|
echo ERROR: clone failed. Check credentials / branch exists.
|
||||||
git clone -b %BRANCH% "%LAN_REMOTE%" "%SRC%_deploy"
|
pause & exit /b 1
|
||||||
if errorlevel 1 ( echo ERROR: clone failed on both remotes. & pause & exit /b 1 )
|
|
||||||
)
|
)
|
||||||
|
|
||||||
REM --- auto-detect git identity from global config ---
|
REM --- auto-detect git identity from existing 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.name') do set GITNAME=%%a
|
||||||
for /f "tokens=*" %%a in ('git config --global user.email') do set GITEMAIL=%%a
|
for /f "tokens=*" %%a in ('git config --global user.email') do set GITEMAIL=%%a
|
||||||
if "!GITNAME!"=="" set GITNAME=jessikitty
|
if "!GITNAME!"=="" set GITNAME=jessikitty
|
||||||
@@ -49,9 +43,6 @@ robocopy "%SRC%." "%SRC%_deploy" /E /XD "_deploy" "node_modules" ".git" /XF "*.l
|
|||||||
pushd "%SRC%_deploy"
|
pushd "%SRC%_deploy"
|
||||||
git config user.name "!GITNAME!"
|
git config user.name "!GITNAME!"
|
||||||
git config user.email "!GITEMAIL!"
|
git config user.email "!GITEMAIL!"
|
||||||
REM larger buffer + HTTP/1.1 makes pushes more robust through a reverse proxy
|
|
||||||
git config http.postBuffer 524288000
|
|
||||||
git config http.version HTTP/1.1
|
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo === Staged changes ===
|
echo === Staged changes ===
|
||||||
@@ -65,27 +56,11 @@ if "!MSG!"=="" set MSG=Update exhibit
|
|||||||
git commit -m "!MSG!"
|
git commit -m "!MSG!"
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo Nothing to commit, or commit failed.
|
echo Nothing to commit, or commit failed.
|
||||||
popd & pause & exit /b 0
|
) else (
|
||||||
)
|
git push origin %BRANCH%
|
||||||
|
if errorlevel 1 ( echo ERROR: push failed. & popd & pause & exit /b 1 )
|
||||||
echo.
|
|
||||||
echo Pushing via HTTPS...
|
|
||||||
git push origin %BRANCH%
|
|
||||||
if errorlevel 1 (
|
|
||||||
echo.
|
echo.
|
||||||
echo HTTPS push failed ^(proxy/500?^). Retrying direct LAN: %LAN_REMOTE%
|
echo === Pushed to %BRANCH% successfully ===
|
||||||
git push "%LAN_REMOTE%" %BRANCH%
|
|
||||||
if errorlevel 1 (
|
|
||||||
echo.
|
|
||||||
echo ERROR: push failed on both remotes.
|
|
||||||
echo Your commit is saved in _deploy - you can retry manually:
|
|
||||||
echo cd "%SRC%_deploy"
|
|
||||||
echo git push origin %BRANCH%
|
|
||||||
echo git push "%LAN_REMOTE%" %BRANCH%
|
|
||||||
popd & pause & exit /b 1
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
echo.
|
|
||||||
echo === Pushed to %BRANCH% successfully ===
|
|
||||||
popd
|
popd
|
||||||
pause
|
pause
|
||||||
|
|||||||
Reference in New Issue
Block a user