Fixed the startup script (again)
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
#!/bin/sh
|
||||
# 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
|
||||
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
|
||||
|
||||
# Constants
|
||||
EXTENSIONS="yml json conf properties" # Space-separated list of extensions
|
||||
ENV="production" # Change this to the environment you need
|
||||
|
||||
@@ -11,10 +11,10 @@ if ERRORLEVEL 1 (
|
||||
:: Get the current branch name
|
||||
FOR /F "delims=" %%i IN ('git symbolic-ref --short HEAD') DO SET CURRENT_BRANCH=%%i
|
||||
|
||||
:: Check if the current branch is 'development'
|
||||
if NOT "!CURRENT_BRANCH!"=="development" (
|
||||
echo Error: You are not on the 'development' branch.
|
||||
echo Please switch to the 'development' branch and run this script again.
|
||||
:: Check if the current branch is 'dev'
|
||||
if NOT "!CURRENT_BRANCH!"=="dev" (
|
||||
echo Error: You are not on the 'dev' branch.
|
||||
echo Please switch to the 'dev' branch and run this script again.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
@@ -34,10 +34,10 @@ echo The following changes will be committed:
|
||||
git status --short
|
||||
|
||||
:: 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" (
|
||||
echo Aborting commit and push to 'development' branch.
|
||||
echo Aborting commit and push to 'dev' branch.
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
@@ -45,14 +45,14 @@ if /I NOT "%CONFIRMATION%"=="yes" (
|
||||
git commit -m "%COMMIT_MESSAGE%"
|
||||
|
||||
:: 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)"
|
||||
echo.
|
||||
|
||||
:: Pull the latest changes from the remote 'development' branch
|
||||
git pull origin development --rebase
|
||||
:: Pull the latest changes from the remote 'dev' branch
|
||||
git pull origin dev --rebase
|
||||
|
||||
:: Push the 'development' branch to the remote repository
|
||||
git push origin development
|
||||
:: Push the 'dev' branch to the remote repository
|
||||
git push origin dev
|
||||
|
||||
echo Successfully pushed changes to 'development' branch.
|
||||
echo Successfully pushed changes to 'dev' branch.
|
||||
|
||||
Reference in New Issue
Block a user