Skip to content

Commit 5e35b74

Browse files
committed
Add release workflow github action
1 parent f930add commit 5e35b74

File tree

3 files changed

+100
-3
lines changed

3 files changed

+100
-3
lines changed

.github/workflows/cd.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: iOS CD
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
type: string
8+
description: "The version number of the release"
9+
required: true
10+
release_branch:
11+
type: string
12+
description: "The release branch with bumped version numbers for the release"
13+
required: true
14+
15+
jobs:
16+
build:
17+
name: Build the binaries for the release and create a PR
18+
runs-on: macos-13
19+
20+
steps:
21+
- name: setup xcode
22+
uses: maxim-lobanov/setup-xcode@v1
23+
with:
24+
xcode-version: '15.2'
25+
- name: Checkout OneSignal-iOS-SDK
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{github.event.inputs.release_branch}}
29+
30+
- name: Install the Apple distribution certificate and provisioning profile
31+
uses: apple-actions/import-codesign-certs@v2
32+
with:
33+
keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
34+
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
35+
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
36+
37+
- name: Install the Apple distribution certificate and provisioning profile
38+
uses: apple-actions/import-codesign-certs@v2
39+
with:
40+
create-keychain: false # do not create a new keychain for this value
41+
keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
42+
p12-file-base64: ${{ secrets.DEV_CERTIFICATES_P12 }}
43+
p12-password: ${{ secrets.DEV_CERTIFICATES_P12_PASSWORD }}
44+
# - name: Bump Version Number
45+
# run: |
46+
- name: Build Binaries
47+
run: |
48+
cd iOS_SDK/OneSignalSDK
49+
chmod +x ./build_all_frameworks.sh
50+
./build_all_frameworks.sh
51+
shell: bash
52+
- name: Code Sign
53+
run: |
54+
cd iOS_SDK/OneSignalSDK
55+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Core/OneSignalCore.xcframework
56+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Extension/OneSignalExtension.xcframework
57+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Outcomes/OneSignalOutcomes.xcframework
58+
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_XCFramework/OneSignal.xcframework
59+
shell: bash
60+
- name: Update Swift Package
61+
run: |
62+
cd iOS_SDK/OneSignalSDK
63+
chmod +x ./update_swift_package.sh
64+
./update_swift_package.sh ${{github.event.inputs.version}}
65+
shell: bash
66+
- name: Commit Changes
67+
run: |
68+
git config --local user.email "[email protected]"
69+
git config --local user.name "SyncR 🤖"
70+
git add .
71+
git commit -m "Release ${{github.event.inputs.version}}"
72+
73+
- name: Pushing changes
74+
uses: ad-m/github-push-action@master
75+
with:
76+
github_token: ${{ secrets.GITHUB_TOKEN }}
77+
repository: 'OneSignal/OneSignal-iOS-SDK'
78+
force: true
79+
branch: ${{github.event.inputs.release_branch}}
80+
81+
- name: "Submitting PR"
82+
uses: octokit/[email protected]
83+
with:
84+
route: POST /repos/{owner}/{repo}/pulls
85+
owner: OneSignal
86+
repo: OneSignal-iOS-SDK
87+
head: ${{github.event.inputs.release_branch}}
88+
base: player-model-main
89+
title: |
90+
"Release ${{github.event.inputs.version}}"
91+
body: |
92+
"Add Release Notes For Review Here"
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

iOS_SDK/OneSignalSDK/build_all_frameworks.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ create_xcframework() {
2424
echo "Created ${FRAMEWORK_FOLDER_NAME}"
2525
echo "Archiving ${FRAMEWORK_NAME}"
2626

27+
xcodebuild -list
28+
2729
xcodebuild archive ONLY_ACTIVE_ARCH=NO -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS Simulator" -archivePath "${SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
2830

2931
xcodebuild archive -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS" -archivePath "${IOS_DEVICE_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

iOS_SDK/OneSignalSDK/update_swift_package.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ SWIFT_PACKAGE_DIRECTORY="${WORKING_DIR}/../.."
2222

2323
SWIFT_PACKAGE_PATH="${SWIFT_PACKAGE_DIRECTORY}/Package.swift"
2424

25-
#Ask for the new release version number to be placed in the package URL
26-
echo -e "\033[1mEnter the new SDK release version number\033[0m"
27-
read VERSION_NUMBER
25+
# Ask for the new release version number to be placed in the package URL
26+
# echo -e "\033[1mEnter the new SDK release version number\033[0m"
27+
# read VERSION_NUMBER
28+
VERSION_NUMBER=$1
2829

2930
# Remove the old Zipped XCFramework and create a new Zip
3031
echo "Removing old Zipped XCFramework ${FRAMEWORK_ZIP_PATH}"

0 commit comments

Comments
 (0)