@@ -24,13 +24,24 @@ permissions:
2424 pull-requests : write
2525
2626jobs :
27- bump-version :
27+ # Step 1: Use reusable workflow to prepare release branch
28+ prep :
29+ uses : OneSignal/sdk-actions/.github/workflows/prep-release.yml@main
30+ with :
31+ version : ${{ github.event.inputs.version }}
32+
33+ # Step 2: Update iOS-specific files and build binaries
34+ update-and-build :
35+ needs : prep
2836 runs-on : macos-13
2937
38+ outputs :
39+ version_from : ${{ steps.extract_version.outputs.current_version }}
40+
3041 env :
3142 VERSION : ${{ github.event.inputs.version }}
3243 BASE_BRANCH : ${{ github.event.inputs.base_branch }}
33- RELEASE_BRANCH : rel/ ${{ github.event.inputs.version }}
44+ RELEASE_BRANCH : ${{ needs.prep.outputs.release_branch }}
3445 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3546
3647 steps :
@@ -39,28 +50,27 @@ jobs:
3950 echo "============================================"
4051 echo "📦 Release Version: $VERSION"
4152 echo "🎯 Base Branch (PR Target): $BASE_BRANCH"
42- echo "🌿 Release Branch (to create) : $RELEASE_BRANCH"
53+ echo "🌿 Release Branch: $RELEASE_BRANCH"
4354 echo "============================================"
4455
4556 - name : Checkout OneSignal-iOS-SDK
4657 uses : actions/checkout@v4
4758 with :
48- ref : ${{ env.BASE_BRANCH }}
59+ ref : ${{ needs.prep.outputs.release_branch }}
4960 fetch-depth : 0
5061
51- - name : Create Release Branch
62+ - name : Configure Git
5263 run : |
53- # Delete remote branch if it exists
54- git push origin --delete $RELEASE_BRANCH || true
55-
56- # Create and checkout new release branch
57- git checkout -b $RELEASE_BRANCH
58- echo "Created release branch: $RELEASE_BRANCH"
59-
60- # Configure git user (only needed once per repo)
6164 git config --local user.email "noreply@onesignal.com"
6265 git config --local user.name "github-actions[bot]"
6366
67+ - name : Extract Current Version
68+ id : extract_version
69+ run : |
70+ CURRENT_VERSION=$(grep -E "s.version\s*=" OneSignal.podspec | sed -E 's/.*"(.*)".*/\1/')
71+ echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
72+ echo "Current version: $CURRENT_VERSION"
73+
6474 - name : Setup Xcode
6575 uses : maxim-lobanov/setup-xcode@v1
6676 with :
@@ -133,97 +143,50 @@ jobs:
133143 git commit -am "chore: update Swift package"
134144 git push origin $RELEASE_BRANCH
135145
136- - name : Fetch Last GitHub Release Tag
137- id : fetch_last_release
138- run : |
139- echo "Fetching latest GitHub release tag..."
140- LAST_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
146+ # Step 3: Use reusable workflow to create iOS SDK PR with release notes
147+ create-ios-pr :
148+ needs : [prep, update-and-build]
149+ uses : OneSignal/sdk-actions/.github/workflows/create-release.yml@main
150+ with :
151+ release_branch : ${{ needs.prep.outputs.release_branch }}
152+ version_from : ${{ needs.update-and-build.outputs.version_from }}
153+ version_to : ${{ github.event.inputs.version }}
154+
155+ # Step 4: Update XCFramework repository
156+ update-xcframework :
157+ needs : [prep, update-and-build, create-ios-pr]
158+ runs-on : macos-13
141159
142- if [[ -z "$LAST_TAG" ]]; then
143- echo "❌ No previous release tag found. Cannot generate release notes."
144- exit 0
145- fi
160+ env :
161+ VERSION : ${{ github.event.inputs.version }}
162+ BASE_BRANCH : ${{ github.event.inputs.base_branch }}
163+ RELEASE_BRANCH : ${{ needs.prep.outputs.release_branch }}
164+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
146165
147- echo "✅ Found last release tag: $LAST_TAG"
148- echo "range=$LAST_TAG..HEAD" >> $GITHUB_OUTPUT
166+ steps :
167+ - name : Checkout OneSignal-iOS-SDK
168+ uses : actions/checkout@v4
169+ with :
170+ ref : ${{ needs.prep.outputs.release_branch }}
171+ path : ios-sdk-repo
149172
150- - name : Generate Release Notes from PR Titles
173+ - name : Get iOS SDK PR Body
151174 run : |
152- echo "## 🔖 Auto-Generated Release Notes" > pr_body.md
153- echo "" >> pr_body.md
154-
155- if [[ "$VERSION" == *"alpha"* ]]; then
156- CHANNEL="alpha"
157- elif [[ "$VERSION" == *"beta"* ]]; then
158- CHANNEL="beta"
159- else
160- CHANNEL="current"
161- fi
162-
163- echo "**Channels:** $CHANNEL" >> pr_body.md
164- echo "" >> pr_body.md
175+ cd ios-sdk-repo
165176
166- RANGE="${{ steps.fetch_last_release.outputs.range }}"
167- echo "📦 Commit range: $RANGE"
177+ # Find the PR that was just created for this version
178+ PR_NUMBER=$(gh pr list --state open --search "Release $VERSION in:title" --json number --jq '.[0].number // empty')
168179
169- COMMITS=$(git log "$RANGE" --pretty=format:"%H" | sort -u)
170-
171- if [[ -z "$COMMITS" ]]; then
172- echo "❌ No commits found. Exiting."
173- exit 0
174- fi
175-
176- > raw_titles.txt
177- for SHA in $COMMITS; do
178- PR_INFO=$(gh api "repos/${{ github.repository }}/commits/$SHA/pulls" \
179- -H "Accept: application/vnd.github.groot-preview+json" 2>/dev/null)
180-
181- TITLE=$(echo "$PR_INFO" | jq -r '.[0].title // empty')
182- NUMBER=$(echo "$PR_INFO" | jq -r '.[0].number // empty')
183-
184- if [[ -n "$TITLE" && -n "$NUMBER" ]]; then
185- echo "$TITLE ([#$NUMBER](https://github.com/${{ github.repository }}/pull/$NUMBER))" >> raw_titles.txt
186- echo "✅ $SHA → $TITLE (#$NUMBER)"
187- else
188- echo "⚠️ $SHA → No PR found"
189- fi
190- done
191-
192- sort -fu raw_titles.txt > pr_titles.txt
193-
194- if [[ ! -s pr_titles.txt ]]; then
195- echo "❌ No PR titles found from commits. Exiting."
196- exit 0
180+ if [[ -n "$PR_NUMBER" ]]; then
181+ echo "Found iOS SDK PR: #$PR_NUMBER"
182+ gh pr view "$PR_NUMBER" --json body --jq '.body' > ../pr_body.md
183+ else
184+ echo "Warning: Could not find iOS SDK PR, using default body"
185+ echo "## Release $VERSION" > ../pr_body.md
186+ echo "" >> ../pr_body.md
187+ echo "See iOS SDK release: https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/$VERSION" >> ../pr_body.md
197188 fi
198189
199- echo "" >> pr_body.md
200- echo "### 🚀 New Features" >> pr_body.md
201- grep -i '^feat' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md
202-
203- echo "" >> pr_body.md
204- echo "### 🐛 Bug Fixes" >> pr_body.md
205- grep -i '^bug' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md
206-
207- echo "" >> pr_body.md
208- echo "### 🔧 Improvements" >> pr_body.md
209- grep -i -E '^(perf|refactor)' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md
210-
211- echo "" >> pr_body.md
212- echo "### 📝 Uncategorized PRs" >> pr_body.md
213- grep -v -i -E '^(feat|bug|perf|refactor)' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md
214-
215- echo "" >> pr_body.md
216- echo "### 📦 Version" >> pr_body.md
217- echo "$VERSION" >> pr_body.md
218-
219- - name : Create Pull Request for iOS SDK
220- run : |
221- gh pr create \
222- --title "Release $VERSION" \
223- --body-file pr_body.md \
224- --head "$RELEASE_BRANCH" \
225- --base "$BASE_BRANCH"
226-
227190 - name : Checkout OneSignal-XCFramework
228191 uses : actions/checkout@v4
229192 with :
@@ -235,7 +198,7 @@ jobs:
235198 - name : Update Package.swift in XCFramework Repository
236199 run : |
237200 # Copy Package.swift from iOS SDK to XCFramework repo
238- cp Package.swift xcframework-repo/Package.swift
201+ cp ios-sdk-repo/ Package.swift xcframework-repo/Package.swift
239202
240203 # Navigate to XCFramework repo
241204 cd xcframework-repo
@@ -255,13 +218,15 @@ jobs:
255218
256219 # Push to remote
257220 git push origin $RELEASE_BRANCH
221+ env :
222+ GH_TOKEN : ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }}
258223
259224 - name : Create Pull Request for XCFramework Repository
260225 env :
261226 GH_TOKEN : ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }}
262-
263227 run : |
264228 cd xcframework-repo
229+
265230 gh pr create \
266231 --title "Release $VERSION" \
267232 --body-file ../pr_body.md \
0 commit comments