|
|
@@ -24,11 +24,6 @@ echo_run() { echo "+ $*"; "$@"; }
|
|
|
push_cmds=()
|
|
|
queue_push() { push_cmds+=("git -C \"$(pwd)\" $*"); echo "+ [queued] (in $(pwd)) git $*"; }
|
|
|
|
|
|
-queue_push_tag () {
|
|
|
- local tag="$1"
|
|
|
- queue_push push origin "refs/tags/$tag"
|
|
|
-}
|
|
|
-
|
|
|
update_follower () {
|
|
|
local DIR="$1"
|
|
|
echo; echo "🔄 Updating $DIR …"
|
|
|
@@ -97,32 +92,30 @@ esac
|
|
|
|
|
|
echo "🔢 Bumping version: $old_ver → $new_ver"
|
|
|
|
|
|
-# --- switch to dev branch ----
|
|
|
+# --- switch to dev so the release branch is cut from latest dev ----
|
|
|
echo_run git switch "$DEV_BRANCH"
|
|
|
echo_run git fetch
|
|
|
echo_run git pull
|
|
|
|
|
|
-# --- update version number ----
|
|
|
+# --- create release branch from dev's tip ----
|
|
|
+RELEASE_BRANCH="release/v${new_ver}"
|
|
|
+echo_run git switch -c "$RELEASE_BRANCH"
|
|
|
+
|
|
|
+# --- bump version on the release branch ----
|
|
|
sed -i '' "s/${MARKETING_KEY}[[:space:]]*=.*/${MARKETING_KEY} = ${new_ver}/" "$VERSION_FILE"
|
|
|
echo_run git diff "$VERSION_FILE"; pause
|
|
|
echo_run git commit -m "update version to ${new_ver} [skip ci]" "$VERSION_FILE"
|
|
|
|
|
|
-echo "💻 Build & test dev branch now."; pause
|
|
|
-queue_push push origin "$DEV_BRANCH"
|
|
|
+echo "💻 Build & test release branch now."; pause
|
|
|
+queue_push push origin "$RELEASE_BRANCH"
|
|
|
|
|
|
-# --- create a patch ---------------------------
|
|
|
+# --- create a patch from main..release branch (includes the bump) -----
|
|
|
mkdir -p "$PATCH_DIR"
|
|
|
PATCH_FILE="${PATCH_DIR}/LF_diff_${old_ver}_to_${new_ver}.patch"
|
|
|
|
|
|
-git diff -M --binary "$MAIN_BRANCH" "$DEV_BRANCH" \
|
|
|
+git diff -M --binary "$MAIN_BRANCH" "$RELEASE_BRANCH" \
|
|
|
> "$PATCH_FILE"
|
|
|
|
|
|
-# --- merge dev into main for new release
|
|
|
-echo_run git switch "$MAIN_BRANCH"
|
|
|
-echo_run git merge "$DEV_BRANCH"
|
|
|
-echo "💻 Build & test main branch now."; pause
|
|
|
-queue_push push origin "$MAIN_BRANCH"
|
|
|
-
|
|
|
cd ..
|
|
|
update_follower "$SECOND_DIR"
|
|
|
update_follower "$THIRD_DIR"
|
|
|
@@ -136,24 +129,39 @@ pause
|
|
|
cd ${PRIMARY_ABS_PATH}
|
|
|
|
|
|
# ---------- push queue ----------
|
|
|
-echo; echo "🚀 Ready to tag and push changes upstream."
|
|
|
+echo; echo "🚀 Ready to push changes upstream and open the release PR."
|
|
|
echo_run git log --oneline -2
|
|
|
|
|
|
-read -rp "▶▶ Ready to tag? (y/n): " confirm
|
|
|
-if [[ $confirm =~ ^[Yy]$ ]]; then
|
|
|
- git tag -a "v${new_ver}" -m "v${new_ver}"
|
|
|
- queue_push_tag "v${new_ver}"
|
|
|
- echo_run git log --oneline -2
|
|
|
-else
|
|
|
- echo "🚫 tag skipped, can add later"
|
|
|
-fi
|
|
|
-
|
|
|
read -rp "▶▶ Push everything now? (y/n): " confirm
|
|
|
if [[ $confirm =~ ^[Yy]$ ]]; then
|
|
|
for cmd in "${push_cmds[@]}"; do echo "+ $cmd"; bash -c "$cmd"; done
|
|
|
echo "🎉 All pushes completed."
|
|
|
- echo; echo "🎉 All repos updated to v${new_ver} (local)."
|
|
|
- echo "👉 Remember to create a GitHub release for tag v${new_ver}."
|
|
|
+
|
|
|
+ echo; echo "📝 Opening sync PR ${RELEASE_BRANCH} → ${DEV_BRANCH} …"
|
|
|
+ gh pr create \
|
|
|
+ --base "$DEV_BRANCH" \
|
|
|
+ --head "$RELEASE_BRANCH" \
|
|
|
+ --title "Sync v${new_ver} version bump to dev" \
|
|
|
+ --body "Syncs the v${new_ver} version bump from the release branch back to \`dev\` so subsequent auto-bumps on \`dev\` continue from the released minor.
|
|
|
+
|
|
|
+\`auto_version_dev\` detects that \`Config.xcconfig\` was changed in this push and skips re-bumping.
|
|
|
+
|
|
|
+⚠️ **Use rebase-merge** (not squash or merge-commit) so \`dev\` and \`main\` end up at the same commit SHA after the release."
|
|
|
+
|
|
|
+ echo; echo "📝 Opening release PR ${RELEASE_BRANCH} → ${MAIN_BRANCH} …"
|
|
|
+ gh pr create \
|
|
|
+ --base "$MAIN_BRANCH" \
|
|
|
+ --head "$RELEASE_BRANCH" \
|
|
|
+ --title "Release v${new_ver}" \
|
|
|
+ --body "Release v${new_ver}.
|
|
|
+
|
|
|
+Merging this PR triggers the tagging workflow, which creates tag \`v${new_ver}\` from \`LOOP_FOLLOW_MARKETING_VERSION\` in \`Config.xcconfig\`.
|
|
|
+
|
|
|
+⚠️ **Use rebase-merge** (not squash or merge-commit) so \`dev\` and \`main\` end up at the same commit SHA after the release."
|
|
|
+
|
|
|
+ echo; echo "🎉 All repos updated to v${new_ver} (local). Release PRs opened (sync → dev, release → main)."
|
|
|
+ echo "👉 Review and merge both PRs — the tag will be created automatically by .github/workflows/tag_on_main.yml."
|
|
|
+ echo "👉 Remember to create a GitHub release for tag v${new_ver} after the tag exists."
|
|
|
else
|
|
|
echo "🚫 Pushes skipped. Run manually if needed:"; printf ' %s\n' "${push_cmds[@]}"
|
|
|
echo "🚫 Release not completed, pushes to GitHub were skipped"
|