@@ -131,22 +131,28 @@ function run_release() {
131131 check_clean_working_directory
132132
133133 # Step 1: Checkout develop branch and sync with main
134- echo " Step 1: Checking out develop branch..."
134+ echo " Step 1: Syncing branches..."
135+ echo " Fetching all branches from origin..."
136+ git fetch origin
137+
138+ echo " Checking out develop branch..."
135139 git checkout develop
136- echo " Pulling latest changes from origin..."
137- git pull origin develop
140+ git reset --hard origin/develop
138141
139- echo " Pulling latest changes from main..."
140- git fetch origin main
141- echo " Merging main into develop to ensure all changes are included..."
142- if ! git merge origin/main -m " Merge main into develop for release" ; then
143- echo " "
144- echo " Merge conflict detected. Please resolve conflicts and run the script again."
145- error " Failed to merge main into develop"
142+ echo " Checking if main needs to be merged into develop..."
143+ # Check if there are commits on main that are not on develop
144+ if git log develop..origin/main --oneline | grep -q . ; then
145+ echo " Found commits on main that need to be merged into develop..."
146+ if ! git merge origin/main -m " Merge main into develop for release" ; then
147+ echo " "
148+ echo " Merge conflict detected. Please resolve conflicts and run the script again."
149+ error " Failed to merge main into develop"
150+ fi
151+ echo " Pushing updated develop to origin..."
152+ git push origin develop
153+ else
154+ echo " Develop is already up to date with main."
146155 fi
147-
148- echo " Pushing updated develop to origin..."
149- git push origin develop
150156 echo " "
151157
152158 # Step 2: Identify latest release
0 commit comments