Fixed the startup script (again)

This commit is contained in:
2026-01-13 21:37:52 +01:00
parent d69cfc9f99
commit ee7d40c4e3
2 changed files with 17 additions and 14 deletions

View File

@@ -1,10 +1,13 @@
#!/bin/sh #!/bin/sh
# Check if Git repo needs updating # Check if Git repo needs updating
# Construct the Git URL - strip https:// if present in GIT_REPO_URL
CLEAN_REPO_URL=$(echo "${GIT_REPO_URL}" | sed 's|^https://||')
if [ -d .git ]; then if [ -d .git ]; then
echo "Pulling latest changes from the repository..." echo "Pulling latest changes from the repository..."
git pull "https://${GIT_USERNAME}:${GIT_PAT}@${GIT_REPO_URL}" "${GIT_BRANCH}" || true git pull "https://${GIT_USERNAME}:${GIT_PAT}@${CLEAN_REPO_URL}" "${GIT_BRANCH}" || true
fi fi
# Constants # Constants
EXTENSIONS="yml json conf properties" # Space-separated list of extensions EXTENSIONS="yml json conf properties" # Space-separated list of extensions
ENV="production" # Change this to the environment you need ENV="production" # Change this to the environment you need

View File

@@ -11,10 +11,10 @@ if ERRORLEVEL 1 (
:: Get the current branch name :: Get the current branch name
FOR /F "delims=" %%i IN ('git symbolic-ref --short HEAD') DO SET CURRENT_BRANCH=%%i FOR /F "delims=" %%i IN ('git symbolic-ref --short HEAD') DO SET CURRENT_BRANCH=%%i
:: Check if the current branch is 'development' :: Check if the current branch is 'dev'
if NOT "!CURRENT_BRANCH!"=="development" ( if NOT "!CURRENT_BRANCH!"=="dev" (
echo Error: You are not on the 'development' branch. echo Error: You are not on the 'dev' branch.
echo Please switch to the 'development' branch and run this script again. echo Please switch to the 'dev' branch and run this script again.
exit /b 1 exit /b 1
) )
@@ -34,10 +34,10 @@ echo The following changes will be committed:
git status --short git status --short
:: Prompt for confirmation to commit :: Prompt for confirmation to commit
set /p CONFIRMATION=Do you want to proceed with the commit and push to 'development' branch? (yes/no): set /p CONFIRMATION=Do you want to proceed with the commit and push to 'dev' branch? (yes/no):
if /I NOT "%CONFIRMATION%"=="yes" ( if /I NOT "%CONFIRMATION%"=="yes" (
echo Aborting commit and push to 'development' branch. echo Aborting commit and push to 'dev' branch.
exit /b 0 exit /b 0
) )
@@ -45,14 +45,14 @@ if /I NOT "%CONFIRMATION%"=="yes" (
git commit -m "%COMMIT_MESSAGE%" git commit -m "%COMMIT_MESSAGE%"
:: Show the last commit :: Show the last commit
echo Last commit on 'development' branch: echo Last commit on 'dev' branch:
git --no-pager log -1 --pretty=format:"%%h - %%s (%%an, %%ar)" git --no-pager log -1 --pretty=format:"%%h - %%s (%%an, %%ar)"
echo. echo.
:: Pull the latest changes from the remote 'development' branch :: Pull the latest changes from the remote 'dev' branch
git pull origin development --rebase git pull origin dev --rebase
:: Push the 'development' branch to the remote repository :: Push the 'dev' branch to the remote repository
git push origin development git push origin dev
echo Successfully pushed changes to 'development' branch. echo Successfully pushed changes to 'dev' branch.