Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 233 additions & 52 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,281 @@
name: iOS CD
name: Create Release PRs

# Note: The "Use workflow from" dropdown selects which version of THIS workflow to run.
# Always select "main" unless you're testing workflow changes from another branch.
# The "base_branch" input below determines where the release PR will be targeted.

on:
workflow_dispatch:
inputs:
version:
description: "The version number of the release (e.g., 5.2.15 or 5.2.3-beta-01)"
type: string
description: "The version number of the release"
required: true
release_branch:
base_branch:
description: 'Target branch for the PR (e.g. main for regular releases, 5.3-main for 5.3.x releases)'
type: string
description: "The release branch with bumped version numbers for the release"
required: true
required: false
default: 'main'

permissions:
contents: write
pull-requests: write

jobs:
build:
name: Build the binaries for the release and create a PR
runs-on: macos-13

env:
VERSION: ${{ github.event.inputs.version }}
BASE_BRANCH: ${{ github.event.inputs.base_branch }}
RELEASE_BRANCH: rel/${{ github.event.inputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: setup xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'
- name: 📋 Display Configuration
run: |
echo "============================================"
echo "📦 Release Version: $VERSION"
echo "🎯 Base Branch (PR Target): $BASE_BRANCH"
echo "🌿 Release Branch (to create): $RELEASE_BRANCH"
echo "============================================"

- name: Checkout OneSignal-iOS-SDK
uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.release_branch}}
ref: ${{ env.BASE_BRANCH }}
fetch-depth: 0

- name: Create Release Branch
run: |
# Delete remote branch if it exists
git push origin --delete $RELEASE_BRANCH || true

# Create and checkout new release branch
git checkout -b $RELEASE_BRANCH
echo "Created release branch: $RELEASE_BRANCH"

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'

- name: Install the Apple distribution certificate and provisioning profile
- name: Install the Apple distribution certificate and provisioning profile (OneSignal)
uses: apple-actions/import-codesign-certs@v2
with:
keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}

- name: Install the Apple distribution certificate and provisioning profile
- name: Install the Apple distribution certificate and provisioning profile (Lilomi)
uses: apple-actions/import-codesign-certs@v2
with:
create-keychain: false # do not create a new keychain for this value
keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
p12-file-base64: ${{ secrets.DEV_CERTIFICATES_P12 }}
p12-password: ${{ secrets.DEV_CERTIFICATES_P12_PASSWORD }}
# - name: Bump Version Number
# run: |
- name: Build Binaries

- name: Update Version in SDK and Podspec Files
run: |
cd iOS_SDK/OneSignalSDK
chmod +x ./build_all_frameworks.sh
./build_all_frameworks.sh
chmod +x ./update_version.sh
./update_version.sh $VERSION
shell: bash
- name: Code Sign

# DO a commit here
- name: Commit and Push Changes
run: |
git config --local user.email "noreply@onesignal.com"
git config --local user.name "SyncR 🤖"

git commit -am "chore: bump version to $VERSION"
git push origin $RELEASE_BRANCH

- name: Build Binaries
run: |
cd iOS_SDK/OneSignalSDK
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Core/OneSignalCore.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Extension/OneSignalExtension.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_InAppMessages/OneSignalInAppMessages.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Location/OneSignalLocation.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Notifications/OneSignalNotifications.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_OSCore/OneSignalOSCore.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Outcomes/OneSignalOutcomes.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_User/OneSignalUser.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_XCFramework/OneSignalFramework.xcframework
codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_LiveActivities/OneSignalLiveActivities.xcframework
chmod +x ./build_all_frameworks.sh
./build_all_frameworks.sh
shell: bash

# - name: Code Sign
# run: |
# cd iOS_SDK/OneSignalSDK
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Core/OneSignalCore.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Extension/OneSignalExtension.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_InAppMessages/OneSignalInAppMessages.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Location/OneSignalLocation.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Notifications/OneSignalNotifications.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_OSCore/OneSignalOSCore.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Outcomes/OneSignalOutcomes.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_User/OneSignalUser.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_XCFramework/OneSignalFramework.xcframework
# codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_LiveActivities/OneSignalLiveActivities.xcframework
# shell: bash

# DO a commit here
# - name: Commit and Push Changes
# run: |
# git config --local user.email "noreply@onesignal.com"
# git config --local user.name "SyncR 🤖"

# git commit -am "chore: build binaries"
# git push origin $RELEASE_BRANCH

- name: Update Swift Package
run: |
cd iOS_SDK/OneSignalSDK
chmod +x ./update_swift_package.sh
./update_swift_package.sh ${{github.event.inputs.version}}
./update_swift_package.sh $VERSION
shell: bash
- name: Commit Changes

- name: Commit and Push Changes
run: |
git config --local user.email "noreply@onesignal.com"
git config --local user.name "SyncR 🤖"
git add .
git commit -m "Release ${{github.event.inputs.version}}"

- name: Pushing changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository: 'OneSignal/OneSignal-iOS-SDK'
force: true
branch: ${{github.event.inputs.release_branch}}
git commit -am "chore: update Swift package"
git push origin $RELEASE_BRANCH


# TODO: Does this consider the base branch?
- name: Fetch Last GitHub Release Tag
id: fetch_last_release
run: |
echo "Fetching latest GitHub release tag..."
LAST_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')

if [[ -z "$LAST_TAG" ]]; then
echo "❌ No previous release tag found. Cannot generate release notes."
exit 0
fi

echo "✅ Found last release tag: $LAST_TAG"
echo "range=$LAST_TAG..HEAD" >> $GITHUB_OUTPUT


- name: Generate Release Notes from PR Titles
run: |
echo "## 🔖 Auto-Generated Release Notes" > pr_body.md
echo "" >> pr_body.md

if [[ "$VERSION" == *"alpha"* ]]; then
CHANNEL="alpha"
elif [[ "$VERSION" == *"beta"* ]]; then
CHANNEL="beta"
else
CHANNEL="current"
fi

echo "**Channels:** $CHANNEL" >> pr_body.md
echo "" >> pr_body.md

RANGE="${{ steps.fetch_last_release.outputs.range }}"
echo "📦 Commit range: $RANGE"

COMMITS=$(git log "$RANGE" --pretty=format:"%H" | sort -u)

if [[ -z "$COMMITS" ]]; then
echo "❌ No commits found. Exiting."
exit 0
fi

> raw_titles.txt
for SHA in $COMMITS; do
PR_INFO=$(gh api "repos/${{ github.repository }}/commits/$SHA/pulls" \
-H "Accept: application/vnd.github.groot-preview+json" 2>/dev/null)

TITLE=$(echo "$PR_INFO" | jq -r '.[0].title // empty')
NUMBER=$(echo "$PR_INFO" | jq -r '.[0].number // empty')

if [[ -n "$TITLE" && -n "$NUMBER" ]]; then
echo "$TITLE ([#$NUMBER](https://github.com/${{ github.repository }}/pull/$NUMBER))" >> raw_titles.txt
echo "✅ $SHA → $TITLE (#$NUMBER)"
else
echo "⚠️ $SHA → No PR found"
fi
done

sort -fu raw_titles.txt > pr_titles.txt

if [[ ! -s pr_titles.txt ]]; then
echo "❌ No PR titles found from commits. Exiting."
exit 0
fi

echo "" >> pr_body.md
echo "### 🚀 New Features" >> pr_body.md
grep -i '^feat' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md

echo "" >> pr_body.md
echo "### 🐛 Bug Fixes" >> pr_body.md
grep -i '^bug' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md

echo "" >> pr_body.md
echo "### 🔧 Improvements" >> pr_body.md
grep -i -E '^(perf|refactor)' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md

echo "" >> pr_body.md
echo "### 📝 Uncategorized PRs" >> pr_body.md
grep -v -i -E '^(feat|bug|perf|refactor)' pr_titles.txt | sed 's/^/- /' >> pr_body.md || echo "- _None_" >> pr_body.md

- name: "Submitting PR"
uses: octokit/request-action@v2.x
echo "" >> pr_body.md
echo "### 📦 Version" >> pr_body.md
echo "$VERSION" >> pr_body.md


- name: Create Pull Request for iOS SDK
run: |
gh pr create \
--title "Release $VERSION" \
--body-file pr_body.md \
--head "$RELEASE_BRANCH" \
--base "$BASE_BRANCH"




- name: Checkout OneSignal-XCFramework
uses: actions/checkout@v4
with:
route: POST /repos/{owner}/{repo}/pulls
owner: OneSignal
repo: OneSignal-iOS-SDK
head: ${{github.event.inputs.release_branch}}
base: main
title: |
"Release ${{github.event.inputs.version}}"
body: |
"Add Release Notes For Review Here"
repository: OneSignal/OneSignal-XCFramework
ref: ${{ env.BASE_BRANCH }}
path: xcframework-repo
token: ${{ secrets.PAT_TOKEN }}

- name: Update Package.swift in XCFramework Repository
run: |
# Copy Package.swift from iOS SDK to XCFramework repo
cp Package.swift xcframework-repo/Package.swift

# Navigate to XCFramework repo
cd xcframework-repo

# Delete remote branch if it exists
git push origin --delete $RELEASE_BRANCH || true

# Create release branch
git checkout -b $RELEASE_BRANCH

# Configure git
git config --local user.email "noreply@onesignal.com"
git config --local user.name "SyncR 🤖"

# Commit changes
git commit -am "Release $VERSION"

# Push to remote
git push origin $RELEASE_BRANCH

- name: Create Pull Request for XCFramework Repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}


run: |
cd xcframework-repo
gh pr create \
--title "Release $VERSION" \
--body-file ../pr_body.md \
--head "$RELEASE_BRANCH" \
--base "$BASE_BRANCH"
2 changes: 1 addition & 1 deletion OneSignal.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneSignal"
s.version = "5.2.15"
s.version = "5.2.16"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
2 changes: 1 addition & 1 deletion OneSignalXCFramework.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneSignalXCFramework"
s.version = "5.2.15"
s.version = "5.2.16"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
Loading