Skip to content
Merged
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
35 changes: 18 additions & 17 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,13 @@ jobs:
fi
echo "✓ Updated Package.swift with iOS SDK ${VERSION}"

for PODFILE in examples/demo/ios/Podfile examples/demo-pods/ios/Podfile; do
sed -i '' -E "s/^([[:space:]]*pod 'OneSignalXCFramework', )'[^']+'.*$/\1'${VERSION}'/" "$PODFILE"
if [ "$(grep -c "pod 'OneSignalXCFramework', '${VERSION}'$" "$PODFILE")" -ne 2 ]; then
echo "::error::Failed to update OneSignalXCFramework pins in ${PODFILE} to ${VERSION}"
exit 1
fi
echo "✓ Updated ${PODFILE} extension pods to iOS SDK ${VERSION}"
done
PODFILE=examples/demo-pods/ios/Podfile
sed -i '' -E "s/^([[:space:]]*pod 'OneSignalXCFramework', )'[^']+'.*$/\1'${VERSION}'/" "$PODFILE"
if [ "$(grep -c "pod 'OneSignalXCFramework', '${VERSION}'$" "$PODFILE")" -ne 2 ]; then
echo "::error::Failed to update OneSignalXCFramework pins in ${PODFILE} to ${VERSION}"
exit 1
fi
echo "✓ Updated ${PODFILE} extension pods to iOS SDK ${VERSION}"

# Only commit if there are changes
git add -A
Expand Down Expand Up @@ -242,17 +241,19 @@ jobs:
for DEMO in examples/demo examples/demo-pods; do
(cd "$DEMO" && vp run setup)
echo "✓ Refreshed ${DEMO}/bun.lock"

if [ -n "$IOS_VERSION" ]; then
(cd "$DEMO/ios" && pod update OneSignalXCFramework)
else
# Still refresh the local react-native-onesignal pod's version and
# checksum; pod install keeps OneSignalXCFramework at its locked version.
(cd "$DEMO/ios" && pod install)
fi
echo "✓ Refreshed ${DEMO}/ios/Podfile.lock"
done

# demo resolves OneSignal-XCFramework through Package.swift, so only
# demo-pods has a Podfile.lock to refresh.
if [ -n "$IOS_VERSION" ]; then
(cd examples/demo-pods/ios && pod update OneSignalXCFramework)
else
# Still refresh the local react-native-onesignal pod's version and
# checksum; pod install keeps OneSignalXCFramework at its locked version.
(cd examples/demo-pods/ios && pod install)
fi
echo "✓ Refreshed examples/demo-pods/ios/Podfile.lock"

# Only commit if there are changes
git add -A
git diff --staged --quiet && exit 0
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,25 @@ jobs:
with:
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
install-pods: 'true'

- name: Cache React Native SwiftPM artifacts
uses: actions/cache@v5
with:
path: ~/Library/Caches/ReactNative/spm-artifacts
key: rn-spm-artifacts-${{ runner.os }}-${{ hashFiles('examples/demo/bun.lock') }}
restore-keys: rn-spm-artifacts-${{ runner.os }}-

- name: Cache Xcode DerivedData
uses: actions/cache@v5
with:
path: examples/demo/ios/build
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/ios/Podfile.lock') }}
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/bun.lock', 'examples/demo/ios/demo.xcodeproj/project.pbxproj') }}
restore-keys: deriveddata-${{ runner.os }}-

- name: Generate SwiftPM packages
working-directory: examples/demo
run: vp run update:spm

- name: Set up iOS codesigning
uses: OneSignal/sdk-shared/.github/actions/setup-ios-demo-codesigning@main
with:
Expand All @@ -111,7 +121,7 @@ jobs:
working-directory: examples/demo/ios
run: |
xcodebuild archive \
-workspace demo.xcworkspace \
-project demo.xcodeproj \
-scheme demo \
-configuration Release \
-sdk iphoneos \
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/ios-spm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: iOS Swift Package Manager

# Builds examples/demo, which links the SDK through Package.swift. Nothing else
# in CI builds the manifest.
on:
pull_request:
paths:
- 'Package.swift'
- 'ios/**'
- 'package.json'
- 'examples/demo/**'
- '.github/workflows/ios-spm.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-demo:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up demo
uses: ./.github/actions/setup-demo
with:
# Debug simulator builds do not bundle JS, so the app never reads these.
onesignal-app-id: 00000000-0000-0000-0000-000000000000
onesignal-api-key: unused

- name: Cache React Native SwiftPM artifacts
uses: actions/cache@v5
with:
path: ~/Library/Caches/ReactNative/spm-artifacts
key: rn-spm-artifacts-${{ runner.os }}-${{ hashFiles('examples/demo/bun.lock') }}
restore-keys: rn-spm-artifacts-${{ runner.os }}-

- name: Generate SwiftPM packages
working-directory: examples/demo
run: vp run update:spm

- name: Build
working-directory: examples/demo/ios
run: |
xcodebuild build \
-project demo.xcodeproj \
-scheme demo \
-configuration Debug \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath build \
-quiet \
CODE_SIGNING_ALLOWED=NO \
COMPILER_INDEX_STORE_ENABLE=NO
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by react-native spm add/update
examples/demo/ios/demo.xcodeproj/.spm-injected.json
4 changes: 3 additions & 1 deletion examples/build-ios.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# iOS Setup (React Native): Push Notifications + Live Activities

Configure the React Native demo iOS project for OneSignal push notifications and live activities. Set the iOS app bundle id to `com.onesignal.sdkdemo` before completing the steps below. All paths below are relative to `examples/demo/ios/` unless stated otherwise.
Configure the React Native demo iOS project for OneSignal push notifications and live activities. Set the iOS app bundle id to `com.onesignal.sdkdemo` before completing the steps below. All paths below are relative to `examples/demo-pods/ios/` unless stated otherwise.

This guide describes the CocoaPods setup that [`demo-pods`](demo-pods) uses. [`demo`](demo) builds with Swift Package Manager instead: its extension targets link the `OneSignalExtension` (service extension) and `OneSignalFramework` (widget) products of `https://github.com/OneSignal/OneSignal-XCFramework`, and there is no Podfile target.

---

Expand Down
32 changes: 16 additions & 16 deletions examples/demo-pods/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/demo-pods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "20.2.0",
"@react-native-community/cli-platform-android": "20.2.0",
"@react-native-community/cli-platform-ios": "20.2.0",
"@react-native-community/cli": "21.0.0",
"@react-native-community/cli-platform-android": "21.0.0",
"@react-native-community/cli-platform-ios": "21.0.0",
"@react-native/babel-preset": "0.88.1",
"@react-native/metro-config": "0.88.1",
"@react-native/typescript-config": "0.88.1",
Expand Down
2 changes: 0 additions & 2 deletions examples/demo/.bundle/config

This file was deleted.

17 changes: 0 additions & 17 deletions examples/demo/Gemfile

This file was deleted.

Loading
Loading