@@ -21,29 +21,16 @@ concurrency:
2121 cancel-in-progress : true
2222
2323jobs :
24- release :
25- runs-on : macos-13
26-
27- env :
28- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
29-
24+ # Step 1: Extract version from podspec
25+ get-version :
26+ runs-on : ubuntu-latest
27+ outputs :
28+ version : ${{ steps.extract_version.outputs.version }}
3029 steps :
3130 - name : Checkout OneSignal-iOS-SDK
3231 uses : actions/checkout@v4
3332 with :
3433 ref : ${{ github.event.inputs.ref }}
35- fetch-depth : 0
36-
37- - name : Detect current branch
38- id : detect_branch
39- run : |
40- if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
41- BRANCH="${{ github.event.inputs.ref }}"
42- else
43- BRANCH="${GITHUB_REF#refs/heads/}"
44- fi
45- echo "branch=$BRANCH" >> $GITHUB_OUTPUT
46- echo "Detected branch: $BRANCH"
4734
4835 - name : Extract release version from podspec
4936 id : extract_version
@@ -52,79 +39,39 @@ jobs:
5239 echo "version=$VERSION" >> $GITHUB_OUTPUT
5340 echo "Extracted version: $VERSION"
5441
55- - name : 📋 Display Configuration
56- run : |
57- echo "============================================"
58- echo "📦 Release Version: ${{ steps.extract_version.outputs.version }}"
59- echo "🌿 Branch: ${{ steps.detect_branch.outputs.branch }}"
60- echo "============================================"
61-
62- - name : Get Merged Release PR
63- id : get_release_pr
64- run : |
65- VERSION="${{ steps.extract_version.outputs.version }}"
66-
67- # Try to find the merged release PR for this version
68- PR_NUMBER=$(gh pr list --state merged --search "Release $VERSION in:title" --json number --jq '.[0].number // empty')
42+ # Step 2: Use reusable workflow to create GitHub release with release notes
43+ create-release :
44+ needs : get-version
45+ uses : OneSignal/sdk-actions/.github/workflows/github-release.yml@main
46+ with :
47+ version : ${{ needs.get-version.outputs.version }}
6948
70- if [[ -n "$PR_NUMBER" ]]; then
71- echo "Found merged release PR: #$PR_NUMBER"
72- echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
73-
74- # Get PR body for release notes
75- gh pr view "$PR_NUMBER" --json body --jq '.body' > pr_body.md || echo "" > pr_body.md
76- else
77- echo "No merged release PR found for version $VERSION"
78- echo "pr_number=" >> $GITHUB_OUTPUT
79- echo "" > pr_body.md
80- fi
49+ # Step 3: Upload the 10 xcframework zips to the release
50+ upload-assets :
51+ needs : [get-version, create-release]
52+ runs-on : macos-13
8153
82- - name : Generate Release Notes
83- run : |
84- VERSION=" ${{ steps.extract_version.outputs.version }}"
54+ env :
55+ VERSION : ${{ needs.get-version.outputs.version }}
56+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8557
86- if [[ -s pr_body.md ]] && [[ -n "${{ steps.get_release_pr.outputs.pr_number }}" ]]; then
87- # Use the PR body from the release PR
88- echo "Using release notes from PR #${{ steps.get_release_pr.outputs.pr_number }}"
89- cp pr_body.md release_notes.md
90- else
91- # Generate release notes from commits
92- echo "## 🔖 Release Notes" > release_notes.md
93- fi
58+ steps :
59+ - name : Checkout OneSignal-iOS-SDK
60+ uses : actions/checkout@v4
61+ with :
62+ ref : ${{ github.event.inputs.ref }}
9463
95- - name : Create Git Tag
64+ - name : 📋 Display Configuration
9665 run : |
97- VERSION="${{ steps.extract_version.outputs.version }}"
98-
99- # Configure git
100- git config --local user.email "noreply@onesignal.com"
101- git config --local user.name "github-actions[bot]"
102-
103- # Create and push tag
104- git tag -a "$VERSION" -m "Release $VERSION"
105- git push origin "$VERSION"
106-
107- echo "✅ Created and pushed tag: $VERSION"
66+ echo "============================================"
67+ echo "📦 Uploading assets for version: $VERSION"
68+ echo "============================================"
10869
109- - name : Create GitHub Release
70+ - name : Upload xcframework zips to release
11071 run : |
111- VERSION="${{ steps.extract_version.outputs.version }}"
112- BRANCH="${{ steps.detect_branch.outputs.branch }}"
113-
11472 cd iOS_SDK/OneSignalSDK
11573
116- # Determine if this is a pre-release
117- PRERELEASE_FLAG=""
118- if [[ "$VERSION" == *"alpha"* ]] || [[ "$VERSION" == *"beta"* ]]; then
119- PRERELEASE_FLAG="--prerelease"
120- echo "Marking as pre-release (alpha/beta detected)"
121- fi
122-
123- gh release create "$VERSION" \
124- --title "Release $VERSION" \
125- --notes-file ../../release_notes.md \
126- --target "$BRANCH" \
127- $PRERELEASE_FLAG \
74+ gh release upload "$VERSION" \
12875 OneSignalCore.xcframework.zip \
12976 OneSignalExtension.xcframework.zip \
13077 OneSignalFramework.xcframework.zip \
13683 OneSignalOutcomes.xcframework.zip \
13784 OneSignalUser.xcframework.zip
13885
139- echo "✅ GitHub release created successfully!"
86+ echo "✅ All xcframework zips uploaded successfully!"
14087 echo "🔗 https://github.com/${{ github.repository }}/releases/tag/$VERSION"
0 commit comments