Skip to content

Commit 902999d

Browse files
committed
Revert "refactor: simplify version sync workflow"
This reverts commit a7c7e5d.
1 parent a7c7e5d commit 902999d

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

.github/workflows/integrate-develop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
create-or-update-pr:
1414
name: Create or Update PR to Staging
1515
runs-on: ubuntu-latest
16-
# Skip if this is a merge from main branch sync PR
17-
if: ${{ !contains(github.event.head_commit.message, 'Sync: main → develop') }}
16+
# Skip if this is a sync commit from main
17+
if: ${{ !contains(github.event.head_commit.message, 'sync version updates from main') && !contains(github.event.head_commit.message, 'Sync: main → develop') && !startsWith(github.event.head_commit.message, 'Merge pull request') && github.event.head_commit.author.name != 'github-actions[bot]' || !contains(github.event.head_commit.message, 'sync/main-to-develop') }}
1818
permissions:
1919
contents: write
2020
pull-requests: write

.github/workflows/update-version.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,22 @@ jobs:
136136
137137
- name: Sync to develop
138138
run: |
139-
echo "🔄 Creating PR to sync changes to develop branch..."
139+
echo "🔄 Syncing changes to develop branch..."
140140
141-
# Create PR directly from main to develop
141+
# Fetch latest develop
142+
git fetch origin develop:develop
143+
144+
# Create sync branch
145+
SYNC_BRANCH="sync/main-to-develop-$(date +%s)"
146+
git checkout -b $SYNC_BRANCH
147+
148+
# Merge main changes
149+
git merge main --no-ff -m "chore: sync version updates from main"
150+
151+
# Push sync branch
152+
git push origin $SYNC_BRANCH
153+
154+
# Create PR
142155
VERSION="${{ steps.version-update.outputs.version }}"
143156
144157
{
@@ -150,15 +163,15 @@ jobs:
150163
echo "Version: **v$VERSION**"
151164
echo ""
152165
echo "### ⚡ Auto-merge"
153-
echo "This PR will be merged automatically to keep branches in sync."
166+
echo "This PR should be merged automatically to keep branches in sync."
154167
echo ""
155168
echo "---"
156169
echo "*This PR was automatically created by the version update workflow*"
157170
} > pr-body.md
158171
159172
PR_URL=$(gh pr create \
160173
--base develop \
161-
--head main \
174+
--head $SYNC_BRANCH \
162175
--title "🔄 Sync: main → develop (v$VERSION)" \
163176
--body-file pr-body.md \
164177
--label "auto-updated")
@@ -174,9 +187,25 @@ jobs:
174187

175188
- name: Sync to staging
176189
run: |
177-
echo "🔄 Creating PR to sync changes to staging branch..."
190+
echo "🔄 Syncing changes to staging branch..."
191+
192+
# Checkout main again
193+
git checkout main
194+
195+
# Fetch latest staging
196+
git fetch origin staging:staging
197+
198+
# Create sync branch
199+
SYNC_BRANCH="sync/main-to-staging-$(date +%s)"
200+
git checkout -b $SYNC_BRANCH
201+
202+
# Merge main changes
203+
git merge main --no-ff -m "chore: sync version updates from main"
204+
205+
# Push sync branch
206+
git push origin $SYNC_BRANCH
178207
179-
# Create PR directly from main to staging
208+
# Create PR
180209
VERSION="${{ steps.version-update.outputs.version }}"
181210
182211
{
@@ -188,15 +217,15 @@ jobs:
188217
echo "Version: **v$VERSION**"
189218
echo ""
190219
echo "### ⚡ Auto-merge"
191-
echo "This PR will be merged automatically to keep branches in sync."
220+
echo "This PR should be merged automatically to keep branches in sync."
192221
echo ""
193222
echo "---"
194223
echo "*This PR was automatically created by the version update workflow*"
195224
} > pr-body-staging.md
196225
197226
PR_URL=$(gh pr create \
198227
--base staging \
199-
--head main \
228+
--head $SYNC_BRANCH \
200229
--title "🔄 Sync: main → staging (v$VERSION)" \
201230
--body-file pr-body-staging.md \
202231
--label "auto-updated")

0 commit comments

Comments
 (0)