11name : Create Release PR
22
3+ # Note: The "Use workflow from" dropdown selects which version of THIS workflow to run.
4+ # Always select "main" unless you're testing workflow changes from another branch.
5+ # The "base_branch" input below determines where the release PR will be targeted.
6+
37on :
48 workflow_dispatch :
59 inputs :
610 version :
711 description : ' New SDK version (e.g. 5.1.38 or 5.2.0-beta1)'
812 type : string
913 required : true
14+ base_branch :
15+ description : ' Target branch for the PR (e.g. main for regular releases, 5.4-main for 5.4.x releases)'
16+ type : string
17+ required : false
18+ default : ' main'
1019
1120permissions :
1221 contents : write
@@ -18,25 +27,58 @@ jobs:
1827
1928 env :
2029 VERSION : ${{ github.event.inputs.version }}
30+ BASE_BRANCH : ${{ github.event.inputs.base_branch || 'main' }}
2131 BRANCH : rel/${{ github.event.inputs.version }}
2232 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2333
2434 steps :
35+ - name : 📋 Display Configuration
36+ run : |
37+ echo "============================================"
38+ echo "📦 Release Version: $VERSION"
39+ echo "🎯 Base Branch (PR Target): $BASE_BRANCH"
40+ echo "🌿 Release Branch (to create): $BRANCH"
41+ echo "============================================"
42+
43+ - name : ✅ Validate Base Branch
44+ run : |
45+ if [[ "$BASE_BRANCH" == "main" ]]; then
46+ echo "✅ Valid base branch: main"
47+ elif [[ "$BASE_BRANCH" =~ ^[0-9]+\.[0-9]+-main$ ]]; then
48+ echo "✅ Valid base branch: $BASE_BRANCH"
49+ else
50+ echo "❌ ERROR: Invalid base branch '$BASE_BRANCH'"
51+ echo ""
52+ echo "Base branch must be either:"
53+ echo " - 'main' (for regular releases)"
54+ echo " - 'X.Y-main' (for version-specific releases, e.g., 5.4-main, 5.5-main)"
55+ echo ""
56+ echo "Examples:"
57+ echo " ✅ main"
58+ echo " ✅ 5.4-main"
59+ echo " ✅ 5.10-main"
60+ echo " ❌ master"
61+ echo " ❌ 5.4"
62+ echo " ❌ 5.4-develop"
63+ exit 1
64+ fi
65+
2566 - name : Checkout repository
2667 uses : actions/checkout@v4
2768 with :
2869 fetch-depth : 0 # Ensure full history for git log
2970 fetch-tags : true
3071
31- - name : Create release branch from main
72+ - name : Create release branch from base
3273 run : |
3374
3475 if git ls-remote --exit-code --heads origin "$BRANCH"; then
3576 echo "Deleting remote branch $BRANCH"
3677 git push origin --delete "$BRANCH"
3778 fi
3879
39- git checkout -b "$BRANCH" origin/main
80+ echo "Creating release branch $BRANCH from $BASE_BRANCH"
81+ git checkout -b "$BRANCH" origin/$BASE_BRANCH
4082
4183 - name : Update SDK_VERSION in gradle.properties
4284 run : |
@@ -141,4 +183,4 @@ jobs:
141183 --title "Release SDK v$VERSION" \
142184 --body-file pr_body.md \
143185 --head "$BRANCH" \
144- --base main
186+ --base "$BASE_BRANCH"
0 commit comments