mirror of
https://github.com/Sygil-Dev/sygil-webui.git
synced 2024-12-15 14:31:44 +03:00
Add a separate update script instead of git pull on startup (#1106)
This commit is contained in:
parent
066f9a31aa
commit
b76e14ea3c
57
update_to_latest.cmd
Normal file
57
update_to_latest.cmd
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
@echo off
|
||||||
|
cd %~dp0
|
||||||
|
|
||||||
|
:: Duplicate code to find miniconda
|
||||||
|
|
||||||
|
IF EXIST custom-conda-path.txt (
|
||||||
|
FOR /F %%i IN (custom-conda-path.txt) DO set v_custom_path=%%i
|
||||||
|
)
|
||||||
|
|
||||||
|
set v_paths=%ProgramData%\miniconda3
|
||||||
|
set v_paths=%v_paths%;%USERPROFILE%\miniconda3
|
||||||
|
set v_paths=%v_paths%;%ProgramData%\anaconda3
|
||||||
|
set v_paths=%v_paths%;%USERPROFILE%\anaconda3
|
||||||
|
|
||||||
|
for %%a in (%v_paths%) do (
|
||||||
|
IF NOT "%v_custom_path%"=="" (
|
||||||
|
set v_paths=%v_custom_path%;%v_paths%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for %%a in (%v_paths%) do (
|
||||||
|
if EXIST "%%a\Scripts\activate.bat" (
|
||||||
|
SET v_conda_path=%%a
|
||||||
|
echo anaconda3/miniconda3 detected in %%a
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
IF "%v_conda_path%"=="" (
|
||||||
|
echo anaconda3/miniconda3 not found. Install from here https://docs.conda.io/en/latest/miniconda.html
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Update
|
||||||
|
|
||||||
|
echo Stashing local changes and pulling latest update...
|
||||||
|
call git stash
|
||||||
|
call git pull
|
||||||
|
echo If you want to restore changes you made before updating, run "git stash pop".
|
||||||
|
call "%v_conda_path%\Scripts\activate.bat"
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
|
||||||
|
set /p "v_last_hash="<"z_version_env.tmp"
|
||||||
|
echo %v_cur_hash%>z_version_env.tmp
|
||||||
|
|
||||||
|
echo Current environment.yaml hash: %v_cur_hash%
|
||||||
|
echo Previous environment.yaml hash: %v_last_hash%
|
||||||
|
|
||||||
|
if "%v_last_hash%" == "%v_cur_hash%" (
|
||||||
|
echo environment.yaml unchanged. dependencies should be up to date.
|
||||||
|
echo if you still have unresolved dependencies, delete "z_version_env.tmp"
|
||||||
|
) else (
|
||||||
|
echo environment.yaml changed. updating dependencies
|
||||||
|
call conda env create --name "%v_conda_env_name%" -f environment.yaml
|
||||||
|
call conda env update --name "%v_conda_env_name%" -f environment.yaml
|
||||||
|
)
|
||||||
|
|
||||||
|
::cmd /k
|
@ -42,24 +42,10 @@ IF "%v_conda_path%"=="" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
:CONDA_FOUND
|
:CONDA_FOUND
|
||||||
echo Stashing local changes and pulling latest update...
|
|
||||||
call git stash
|
|
||||||
call git pull
|
|
||||||
call "%v_conda_path%\Scripts\activate.bat"
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
|
if not exist "z_version_env.tmp" (
|
||||||
set /p "v_last_hash="<"z_version_env.tmp"
|
:: first time running, we need to update
|
||||||
echo %v_cur_hash%>z_version_env.tmp
|
call "update_to_latest.cmd"
|
||||||
|
|
||||||
echo Current environment.yaml hash: %v_cur_hash%
|
|
||||||
echo Previous environment.yaml hash: %v_last_hash%
|
|
||||||
|
|
||||||
if "%v_last_hash%" == "%v_cur_hash%" (
|
|
||||||
echo environment.yaml version doesn't change
|
|
||||||
) else (
|
|
||||||
echo environment.yaml changed, updating dependencies
|
|
||||||
call conda env create --name "%v_conda_env_name%" -f environment.yaml
|
|
||||||
call conda env update --name "%v_conda_env_name%" -f environment.yaml
|
|
||||||
)
|
)
|
||||||
|
|
||||||
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
|
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
|
||||||
|
20
webui.cmd
20
webui.cmd
@ -42,24 +42,10 @@ IF "%v_conda_path%"=="" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
:CONDA_FOUND
|
:CONDA_FOUND
|
||||||
echo Stashing local changes and pulling latest update...
|
|
||||||
call git stash
|
|
||||||
call git pull
|
|
||||||
call "%v_conda_path%\Scripts\activate.bat"
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
|
if not exist "z_version_env.tmp" (
|
||||||
set /p "v_last_hash="<"z_version_env.tmp"
|
:: first time running, we need to update
|
||||||
echo %v_cur_hash%>z_version_env.tmp
|
call "update_to_latest.cmd"
|
||||||
|
|
||||||
echo Current environment.yaml hash: %v_cur_hash%
|
|
||||||
echo Previous environment.yaml hash: %v_last_hash%
|
|
||||||
|
|
||||||
if "%v_last_hash%" == "%v_cur_hash%" (
|
|
||||||
echo environment.yaml version doesn't change
|
|
||||||
) else (
|
|
||||||
echo environment.yaml changed, updating dependencies
|
|
||||||
call conda env create --name "%v_conda_env_name%" -f environment.yaml
|
|
||||||
call conda env update --name "%v_conda_env_name%" -f environment.yaml
|
|
||||||
)
|
)
|
||||||
|
|
||||||
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
|
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
|
||||||
|
Loading…
Reference in New Issue
Block a user