Skip to content

Commit 4aa5e4a

Browse files
committed
ci: Update create-release-prs workflow
* This script will read the VERSION and update the 2 podspec files and the ONESIGNAL_VERSION's in the SDK * Add this to the CD script as a step. * This is similar to existing scripts `update_swift_package.sh` and `build_all_frameworks.sh` - Also, rename cd.yml to create-release-prs.yml for clarity
1 parent 7a22b21 commit 4aa5e4a

File tree

3 files changed

+316
-100
lines changed

3 files changed

+316
-100
lines changed

.github/workflows/cd.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
name: Create Release PRs
2+
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+
7+
# This workflow bumps version and creates PRs in the iOS-SDK and XCFramework SDK.
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: "The version number of the release (e.g., 5.2.15 or 5.2.3-beta-01)"
14+
type: string
15+
required: true
16+
base_branch:
17+
description: 'Target branch for the PR (e.g. main for regular releases, 5.3-main for 5.3.x releases)'
18+
type: string
19+
required: false
20+
default: 'main'
21+
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
26+
jobs:
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
36+
runs-on: macos-13
37+
38+
outputs:
39+
version_from: ${{ steps.extract_version.outputs.current_version }}
40+
41+
env:
42+
VERSION: ${{ github.event.inputs.version }}
43+
BASE_BRANCH: ${{ github.event.inputs.base_branch }}
44+
RELEASE_BRANCH: ${{ needs.prep.outputs.release_branch }}
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
steps:
48+
- name: 📋 Display Configuration
49+
run: |
50+
echo "============================================"
51+
echo "📦 Release Version: $VERSION"
52+
echo "🎯 Base Branch (PR Target): $BASE_BRANCH"
53+
echo "🌿 Release Branch: $RELEASE_BRANCH"
54+
echo "============================================"
55+
56+
- name: Checkout OneSignal-iOS-SDK
57+
uses: actions/checkout@v4
58+
with:
59+
ref: ${{ needs.prep.outputs.release_branch }}
60+
fetch-depth: 0
61+
62+
- name: Configure Git
63+
run: |
64+
git config --local user.email "noreply@onesignal.com"
65+
git config --local user.name "github-actions[bot]"
66+
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+
74+
- name: Setup Xcode
75+
uses: maxim-lobanov/setup-xcode@v1
76+
with:
77+
xcode-version: '15.2'
78+
79+
- name: Install the Apple distribution certificate and provisioning profile (OneSignal)
80+
uses: apple-actions/import-codesign-certs@v2
81+
with:
82+
keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
83+
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
84+
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
85+
86+
- name: Install the Apple distribution certificate and provisioning profile (Lilomi)
87+
uses: apple-actions/import-codesign-certs@v2
88+
with:
89+
create-keychain: false # do not create a new keychain for this value
90+
keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
91+
p12-file-base64: ${{ secrets.DEV_CERTIFICATES_P12 }}
92+
p12-password: ${{ secrets.DEV_CERTIFICATES_P12_PASSWORD }}
93+
94+
- name: Update Version in SDK and Podspec Files
95+
run: |
96+
cd iOS_SDK/OneSignalSDK
97+
chmod +x ./update_version.sh
98+
./update_version.sh $VERSION
99+
shell: bash
100+
101+
- name: Commit Version Bump and Push Changes
102+
run: |
103+
git commit -am "chore: bump version to $VERSION"
104+
git push origin $RELEASE_BRANCH
105+
106+
- name: Build Binaries
107+
run: |
108+
cd iOS_SDK/OneSignalSDK
109+
chmod +x ./build_all_frameworks.sh
110+
./build_all_frameworks.sh
111+
shell: bash
112+
113+
- name: Code Sign
114+
run: |
115+
cd iOS_SDK/OneSignalSDK
116+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Core/OneSignalCore.xcframework
117+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Extension/OneSignalExtension.xcframework
118+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_InAppMessages/OneSignalInAppMessages.xcframework
119+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Location/OneSignalLocation.xcframework
120+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Notifications/OneSignalNotifications.xcframework
121+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_OSCore/OneSignalOSCore.xcframework
122+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Outcomes/OneSignalOutcomes.xcframework
123+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_User/OneSignalUser.xcframework
124+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_XCFramework/OneSignalFramework.xcframework
125+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_LiveActivities/OneSignalLiveActivities.xcframework
126+
shell: bash
127+
128+
- name: Commit Build and Push Changes
129+
run: |
130+
git commit -am "chore: build binaries"
131+
git push origin $RELEASE_BRANCH
132+
133+
- name: Update Swift Package
134+
run: |
135+
cd iOS_SDK/OneSignalSDK
136+
chmod +x ./update_swift_package.sh
137+
./update_swift_package.sh $VERSION
138+
shell: bash
139+
140+
- name: Commit Swift Package and Push Changes
141+
run: |
142+
git commit -am "chore: update Swift package"
143+
git push origin $RELEASE_BRANCH
144+
145+
# Step 3: Use reusable workflow to create iOS SDK PR with release notes
146+
create-ios-pr:
147+
needs: [prep, update-and-build]
148+
uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main
149+
with:
150+
release_branch: ${{ needs.prep.outputs.release_branch }}
151+
version_from: ${{ needs.update-and-build.outputs.version_from }}
152+
version_to: ${{ github.event.inputs.version }}
153+
154+
# Step 4: Update XCFramework repository
155+
update-xcframework:
156+
needs: [prep, update-and-build, create-ios-pr]
157+
runs-on: macos-13
158+
159+
env:
160+
VERSION: ${{ github.event.inputs.version }}
161+
BASE_BRANCH: ${{ github.event.inputs.base_branch }}
162+
RELEASE_BRANCH: ${{ needs.prep.outputs.release_branch }}
163+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
165+
steps:
166+
- name: Checkout OneSignal-iOS-SDK
167+
uses: actions/checkout@v4
168+
with:
169+
ref: ${{ needs.prep.outputs.release_branch }}
170+
path: ios-sdk-repo
171+
172+
- name: Get iOS SDK PR Body
173+
run: |
174+
cd ios-sdk-repo
175+
176+
# Find the PR that was just created for this version
177+
PR_NUMBER=$(gh pr list --state open --search "Release $VERSION in:title" --json number --jq '.[0].number // empty')
178+
179+
if [[ -n "$PR_NUMBER" ]]; then
180+
echo "Found iOS SDK PR: #$PR_NUMBER"
181+
gh pr view "$PR_NUMBER" --json body --jq '.body' > ../pr_body.md
182+
else
183+
echo "Warning: Could not find iOS SDK PR, using default body"
184+
echo "## Release $VERSION" > ../pr_body.md
185+
echo "" >> ../pr_body.md
186+
echo "See iOS SDK release: https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/$VERSION" >> ../pr_body.md
187+
fi
188+
189+
- name: Checkout OneSignal-XCFramework
190+
uses: actions/checkout@v4
191+
with:
192+
repository: OneSignal/OneSignal-XCFramework
193+
ref: ${{ env.BASE_BRANCH }}
194+
path: xcframework-repo
195+
token: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }}
196+
197+
- name: Update Package.swift in XCFramework Repository
198+
run: |
199+
# Copy Package.swift from iOS SDK to XCFramework repo
200+
cp ios-sdk-repo/Package.swift xcframework-repo/Package.swift
201+
202+
# Update package name to OneSignalXCFramework
203+
sed -i '' 's/name: "OneSignalFramework"/name: "OneSignalXCFramework"/' xcframework-repo/Package.swift
204+
205+
# Navigate to XCFramework repo
206+
cd xcframework-repo
207+
208+
# Delete remote branch if it exists
209+
git push origin --delete $RELEASE_BRANCH || true
210+
211+
# Create release branch
212+
git checkout -b $RELEASE_BRANCH
213+
214+
# Configure git
215+
git config --local user.email "noreply@onesignal.com"
216+
git config --local user.name "github-actions[bot]"
217+
218+
# Commit changes
219+
git commit -am "Release $VERSION"
220+
221+
# Push to remote
222+
git push origin $RELEASE_BRANCH
223+
env:
224+
GH_TOKEN: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }}
225+
226+
- name: Create Pull Request for XCFramework Repository
227+
env:
228+
GH_TOKEN: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }}
229+
run: |
230+
cd xcframework-repo
231+
232+
gh pr create \
233+
--title "Release $VERSION" \
234+
--body-file ../pr_body.md \
235+
--head "$RELEASE_BRANCH" \
236+
--base "$BASE_BRANCH"

0 commit comments

Comments
 (0)