From 7a22b212e8ef6cf296f03073261fc5356e3284af Mon Sep 17 00:00:00 2001 From: Nan Date: Wed, 29 Oct 2025 13:34:48 -0700 Subject: [PATCH 1/8] nit(cleanup): remove unused semantic version helpers These methods are unused, leftover dead code. --- .../Source/Categories/NSString+OneSignal.h | 2 -- .../Source/Categories/NSString+OneSignal.m | 24 ------------------- iOS_SDK/OneSignalSDK/Source/OneSignal.m | 16 ------------- .../OneSignalSDK/Source/OneSignalFramework.h | 3 --- 4 files changed, 45 deletions(-) diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.h b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.h index c9ee3aa87..1b48a86e6 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.h +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.h @@ -31,9 +31,7 @@ #define NSString_OneSignal_h @interface NSString (OneSignal) -- (NSString *_Nonnull)one_getVersionForRange:(NSRange)range; - (NSString *_Nonnull)one_substringAfter:(NSString *_Nonnull)needle; -- (NSString *_Nonnull)one_getSemanticVersion; - (NSString *_Nullable)fileExtensionForMimeType; - (NSString *_Nullable)supportedFileExtension; diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.m b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.m index 79b0d0c12..b8fe1fab4 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.m +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/Categories/NSString+OneSignal.m @@ -41,30 +41,6 @@ - (NSString *)one_substringAfter:(NSString *)needle } -- (NSString*)one_getVersionForRange:(NSRange)range { - - unichar myBuffer[2]; - [self getCharacters:myBuffer range:range]; - NSString *ver = [NSString stringWithCharacters:myBuffer length:2]; - if([ver hasPrefix:@"0"]){ - return [ver one_substringAfter:@"0"]; - } - else{ - return ver; - } -} - -- (NSString*)one_getSemanticVersion { - - NSMutableString *tmpstr = [[NSMutableString alloc] initWithCapacity:5]; - - for ( int i = 0; i <=4; i+=2 ){ - [tmpstr appendString:[self one_getVersionForRange:NSMakeRange(i, 2)]]; - if (i != 4)[tmpstr appendString:@"."]; - } - - return (NSString*)tmpstr; -} - (NSString *)supportedFileExtension { NSArray *components = [self componentsSeparatedByString:@"."]; diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignal.m b/iOS_SDK/OneSignalSDK/Source/OneSignal.m index 10e7157ce..ad65bf2ca 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignal.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignal.m @@ -133,22 +133,6 @@ + (OneSignalReceiveReceiptsController*)receiveReceiptsController { return _receiveReceiptsController; } -+ (NSString*)sdkVersionRaw { - return ONESIGNAL_VERSION; -} - -// TODO: Is this method used by wrappers? It is not used by this SDK. Can we remove? -+ (NSString*)sdkSemanticVersion { - // examples: - // ONESIGNAL_VERSION = @"020402" returns 2.4.2 - // ONESIGNAL_VERSION = @"001000" returns 0.10.0 - // so that's 6 digits, where the first two are the major version - // the second two are the minor version and that last two, the patch. - // c.f. http://semver.org/ - - return [ONESIGNAL_VERSION one_getSemanticVersion]; -} - //TODO: This is related to unit tests and will change with um tests + (void)clearStatics { [OneSignalConfigManager setAppId:nil]; diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h b/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h index fd5f70c55..1a466d00a 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h +++ b/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h @@ -62,9 +62,6 @@ typedef void (^OSFailureBlock)(NSError* error); // ======= OneSignal Class Interface ========= @interface OneSignal : NSObject -+ (NSString* _Nonnull)sdkVersionRaw; -+ (NSString* _Nonnull)sdkSemanticVersion; - #pragma mark User + (id)User NS_REFINED_FOR_SWIFT; + (void)login:(NSString * _Nonnull)externalId; From 4aa5e4ad55ccf812221ccd60b31da4808b3795f2 Mon Sep 17 00:00:00 2001 From: Nan Date: Wed, 29 Oct 2025 12:35:36 -0700 Subject: [PATCH 2/8] 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 --- .github/workflows/cd.yml | 100 ---------- .github/workflows/create-release-prs.yml | 236 +++++++++++++++++++++++ iOS_SDK/OneSignalSDK/update_version.sh | 80 ++++++++ 3 files changed, 316 insertions(+), 100 deletions(-) delete mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/create-release-prs.yml create mode 100755 iOS_SDK/OneSignalSDK/update_version.sh diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index 7b9792e19..000000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: iOS CD - -on: - workflow_dispatch: - inputs: - version: - type: string - description: "The version number of the release" - required: true - release_branch: - type: string - description: "The release branch with bumped version numbers for the release" - required: true - -jobs: - build: - name: Build the binaries for the release and create a PR - runs-on: macos-13 - - steps: - - name: setup xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '15.2' - - name: Checkout OneSignal-iOS-SDK - uses: actions/checkout@v4 - with: - ref: ${{github.event.inputs.release_branch}} - - - name: Install the Apple distribution certificate and provisioning profile - 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 - 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 - run: | - cd iOS_SDK/OneSignalSDK - 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 - - name: Update Swift Package - run: | - cd iOS_SDK/OneSignalSDK - chmod +x ./update_swift_package.sh - ./update_swift_package.sh ${{github.event.inputs.version}} - shell: bash - - name: Commit 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}} - - - name: "Submitting PR" - uses: octokit/request-action@v2.x - 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" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create-release-prs.yml b/.github/workflows/create-release-prs.yml new file mode 100644 index 000000000..bae73be30 --- /dev/null +++ b/.github/workflows/create-release-prs.yml @@ -0,0 +1,236 @@ +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. + +# This workflow bumps version and creates PRs in the iOS-SDK and XCFramework SDK. + +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 + required: true + base_branch: + description: 'Target branch for the PR (e.g. main for regular releases, 5.3-main for 5.3.x releases)' + type: string + required: false + default: 'main' + +permissions: + contents: write + pull-requests: write + +jobs: + # Step 1: Use reusable workflow to prepare release branch + prep: + uses: OneSignal/sdk-actions/.github/workflows/prep-release.yml@main + with: + version: ${{ github.event.inputs.version }} + + # Step 2: Update iOS-specific files and build binaries + update-and-build: + needs: prep + runs-on: macos-13 + + outputs: + version_from: ${{ steps.extract_version.outputs.current_version }} + + env: + VERSION: ${{ github.event.inputs.version }} + BASE_BRANCH: ${{ github.event.inputs.base_branch }} + RELEASE_BRANCH: ${{ needs.prep.outputs.release_branch }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: 📋 Display Configuration + run: | + echo "============================================" + echo "📦 Release Version: $VERSION" + echo "🎯 Base Branch (PR Target): $BASE_BRANCH" + echo "🌿 Release Branch: $RELEASE_BRANCH" + echo "============================================" + + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v4 + with: + ref: ${{ needs.prep.outputs.release_branch }} + fetch-depth: 0 + + - name: Configure Git + run: | + git config --local user.email "noreply@onesignal.com" + git config --local user.name "github-actions[bot]" + + - name: Extract Current Version + id: extract_version + run: | + CURRENT_VERSION=$(grep -E "s.version\s*=" OneSignal.podspec | sed -E 's/.*"(.*)".*/\1/') + echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + echo "Current version: $CURRENT_VERSION" + + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.2' + + - 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 (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: Update Version in SDK and Podspec Files + run: | + cd iOS_SDK/OneSignalSDK + chmod +x ./update_version.sh + ./update_version.sh $VERSION + shell: bash + + - name: Commit Version Bump and Push Changes + run: | + git commit -am "chore: bump version to $VERSION" + git push origin $RELEASE_BRANCH + + - name: Build Binaries + run: | + cd iOS_SDK/OneSignalSDK + 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 + + - name: Commit Build and Push Changes + run: | + 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 $VERSION + shell: bash + + - name: Commit Swift Package and Push Changes + run: | + git commit -am "chore: update Swift package" + git push origin $RELEASE_BRANCH + + # Step 3: Use reusable workflow to create iOS SDK PR with release notes + create-ios-pr: + needs: [prep, update-and-build] + uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main + with: + release_branch: ${{ needs.prep.outputs.release_branch }} + version_from: ${{ needs.update-and-build.outputs.version_from }} + version_to: ${{ github.event.inputs.version }} + + # Step 4: Update XCFramework repository + update-xcframework: + needs: [prep, update-and-build, create-ios-pr] + runs-on: macos-13 + + env: + VERSION: ${{ github.event.inputs.version }} + BASE_BRANCH: ${{ github.event.inputs.base_branch }} + RELEASE_BRANCH: ${{ needs.prep.outputs.release_branch }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v4 + with: + ref: ${{ needs.prep.outputs.release_branch }} + path: ios-sdk-repo + + - name: Get iOS SDK PR Body + run: | + cd ios-sdk-repo + + # Find the PR that was just created for this version + PR_NUMBER=$(gh pr list --state open --search "Release $VERSION in:title" --json number --jq '.[0].number // empty') + + if [[ -n "$PR_NUMBER" ]]; then + echo "Found iOS SDK PR: #$PR_NUMBER" + gh pr view "$PR_NUMBER" --json body --jq '.body' > ../pr_body.md + else + echo "Warning: Could not find iOS SDK PR, using default body" + echo "## Release $VERSION" > ../pr_body.md + echo "" >> ../pr_body.md + echo "See iOS SDK release: https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/$VERSION" >> ../pr_body.md + fi + + - name: Checkout OneSignal-XCFramework + uses: actions/checkout@v4 + with: + repository: OneSignal/OneSignal-XCFramework + ref: ${{ env.BASE_BRANCH }} + path: xcframework-repo + token: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }} + + - name: Update Package.swift in XCFramework Repository + run: | + # Copy Package.swift from iOS SDK to XCFramework repo + cp ios-sdk-repo/Package.swift xcframework-repo/Package.swift + + # Update package name to OneSignalXCFramework + sed -i '' 's/name: "OneSignalFramework"/name: "OneSignalXCFramework"/' 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 "github-actions[bot]" + + # Commit changes + git commit -am "Release $VERSION" + + # Push to remote + git push origin $RELEASE_BRANCH + env: + GH_TOKEN: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }} + + - name: Create Pull Request for XCFramework Repository + env: + GH_TOKEN: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }} + run: | + cd xcframework-repo + + gh pr create \ + --title "Release $VERSION" \ + --body-file ../pr_body.md \ + --head "$RELEASE_BRANCH" \ + --base "$BASE_BRANCH" diff --git a/iOS_SDK/OneSignalSDK/update_version.sh b/iOS_SDK/OneSignalSDK/update_version.sh new file mode 100755 index 000000000..401568789 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/update_version.sh @@ -0,0 +1,80 @@ +#!/bin/bash +set -e + +# Script to update the SDK version across the codebase +# Updates: .podspec files and ONESIGNAL_VERSION +# Usage: ./update_version.sh + +if [ -z "$1" ]; then + echo "Error: Version number is required" + echo "Usage: ./update_version.sh " + exit 1 +fi + +VERSION=$1 + +WORKING_DIR=$(pwd) +REPO_ROOT="${WORKING_DIR}/../.." + +# Validate version format (supports X.Y.Z or X.Y.Z-suffix) +if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then + echo "Error: Version must be in format X.Y.Z or X.Y.Z-suffix (e.g., 5.2.15 or 5.2.3-beta-01)" + exit 1 +fi + +# Convert semantic version to numeric version +# Examples: "5.2.15" -> "050215", "5.2.3-beta-01" -> "050203-beta-01" +convert_to_numeric() { + local version=$1 + local version_part="" + local suffix="" + + # Split by dash to separate version and suffix + if [[ $version == *"-"* ]]; then + version_part="${version%%-*}" + suffix="-${version#*-}" + else + version_part="$version" + fi + + # Split version by dots and pad each part to 2 digits + IFS='.' read -r major minor patch <<< "$version_part" + printf "%02d%02d%02d%s" "$major" "$minor" "$patch" "$suffix" +} + +VERSION_NUMERIC=$(convert_to_numeric "$VERSION") + +ONESIGNAL_PODSPEC="${REPO_ROOT}/OneSignal.podspec" +ONESIGNAL_XCFRAMEWORK_PODSPEC="${REPO_ROOT}/OneSignalXCFramework.podspec" +ONESIGNAL_COMMON_DEFINES="${WORKING_DIR}/OneSignalCore/Source/OneSignalCommonDefines.h" + +echo "Updating version to ${VERSION}..." + +# Update OneSignal.podspec +if [ -f "$ONESIGNAL_PODSPEC" ]; then + sed -i '' "s/s\.version[[:space:]]*=[[:space:]]*\"[^\"]*\"/s.version = \"${VERSION}\"/" "$ONESIGNAL_PODSPEC" + echo "✓ Updated OneSignal.podspec" +else + echo "Error: OneSignal.podspec not found at ${ONESIGNAL_PODSPEC}" + exit 1 +fi + +# Update OneSignalXCFramework.podspec +if [ -f "$ONESIGNAL_XCFRAMEWORK_PODSPEC" ]; then + sed -i '' "s/s\.version[[:space:]]*=[[:space:]]*\"[^\"]*\"/s.version = \"${VERSION}\"/" "$ONESIGNAL_XCFRAMEWORK_PODSPEC" + echo "✓ Updated OneSignalXCFramework.podspec" +else + echo "Error: OneSignalXCFramework.podspec not found at ${ONESIGNAL_XCFRAMEWORK_PODSPEC}" + exit 1 +fi + +# Update OneSignalCommonDefines.h +if [ -f "$ONESIGNAL_COMMON_DEFINES" ]; then + sed -i '' "s/^#define ONESIGNAL_VERSION[[:space:]]*@\"[^\"]*\"/#define ONESIGNAL_VERSION @\"${VERSION_NUMERIC}\"/" "$ONESIGNAL_COMMON_DEFINES" + echo "✓ Updated ONESIGNAL_VERSION in OneSignalCommonDefines.h to ${VERSION_NUMERIC}" +else + echo "Error: OneSignalCommonDefines.h not found at ${ONESIGNAL_COMMON_DEFINES}" + exit 1 +fi + +echo "Successfully updated version to ${VERSION} (numeric: ${VERSION_NUMERIC}) in all files" From d17bda769dc69cd109b353d739f94136aaae2d9a Mon Sep 17 00:00:00 2001 From: Nan Date: Fri, 31 Oct 2025 13:16:54 -0700 Subject: [PATCH 3/8] ci: add `create-github-release.yml` to make tagged release with zips Creates GH release for OneSignal-iOS-SDK. Does not create release for OneSignal-XCFramework --- .github/workflows/create-github-release.yml | 87 +++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/create-github-release.yml diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml new file mode 100644 index 000000000..7c57c3169 --- /dev/null +++ b/.github/workflows/create-github-release.yml @@ -0,0 +1,87 @@ +name: Create GitHub Release + +# This workflow creates a GitHub release in iOS-SDK and attaches the built zip files. +# Run this AFTER the release PR has been merged. + +on: + workflow_dispatch: + inputs: + ref: + description: 'Branch or commit SHA to run on (e.g., main, 5.3-main)' + type: string + required: false + default: 'main' + +permissions: + contents: write + pull-requests: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Step 1: Extract version from podspec + get-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.extract_version.outputs.version }} + steps: + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + + - name: Extract release version from podspec + id: extract_version + run: | + VERSION=$(grep -E "s.version\s*=" OneSignal.podspec | sed -E 's/.*"(.*)".*/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + # Step 2: Use reusable workflow to create GitHub release with release notes + create-release: + needs: get-version + uses: OneSignal/sdk-actions/.github/workflows/github-release.yml@main + with: + version: ${{ needs.get-version.outputs.version }} + + # Step 3: Upload the 10 xcframework zips to the release + upload-assets: + needs: [get-version, create-release] + runs-on: macos-13 + + env: + VERSION: ${{ needs.get-version.outputs.version }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + + - name: 📋 Display Configuration + run: | + echo "============================================" + echo "📦 Uploading assets for version: $VERSION" + echo "============================================" + + - name: Upload xcframework zips to release + run: | + cd iOS_SDK/OneSignalSDK + + gh release upload "$VERSION" \ + OneSignalCore.xcframework.zip \ + OneSignalExtension.xcframework.zip \ + OneSignalFramework.xcframework.zip \ + OneSignalInAppMessages.xcframework.zip \ + OneSignalLiveActivities.xcframework.zip \ + OneSignalLocation.xcframework.zip \ + OneSignalNotifications.xcframework.zip \ + OneSignalOSCore.xcframework.zip \ + OneSignalOutcomes.xcframework.zip \ + OneSignalUser.xcframework.zip + + echo "✅ All xcframework zips uploaded successfully!" + echo "🔗 https://github.com/${{ github.repository }}/releases/tag/$VERSION" From 07a1b16dd3e97008abf2a5de112dca27bae44281 Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 3 Nov 2025 11:27:45 -0800 Subject: [PATCH 4/8] ci: add `publish-release.yml` to push to pods, SPM * Pushes OneSignal and OneSignalXCFramework pods * Takes the release notes from OneSignal-iOS-SDK and makes a release XCFramework --- .github/workflows/publish-release.yml | 183 ++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 000000000..b67bb7a02 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,183 @@ +name: Publish Release to CocoaPods and SPM + +# This workflow publishes the OneSignal pods to CocoaPods trunk. +# And creates the tagged release in the OneSignal-XCFramework repository for SPM. +# Run this AFTER the release PR has been merged and the GitHub release has been created. + +on: + workflow_dispatch: + inputs: + ref: + description: 'Branch or commit SHA to run on (e.g., main, 5.3-main)' + type: string + required: false + default: 'main' + +permissions: + contents: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish: + runs-on: macos-13 + + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + fetch-depth: 0 + + - name: Detect current branch + id: detect_branch + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + BRANCH="${{ github.event.inputs.ref }}" + else + BRANCH="${GITHUB_REF#refs/heads/}" + fi + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + echo "Detected branch: $BRANCH" + + - name: Extract release version from podspec + id: extract_version + run: | + VERSION=$(grep -E "s.version\s*=" OneSignal.podspec | sed -E 's/.*"(.*)".*/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + - name: 📋 Display Configuration + run: | + echo "============================================" + echo "📦 Release Version: ${{ steps.extract_version.outputs.version }}" + echo "🌿 Branch: ${{ steps.detect_branch.outputs.branch }}" + echo "============================================" + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + + - name: Install CocoaPods + run: | + gem install cocoapods + pod --version + + - name: Validate OneSignal.podspec + run: | + echo "Validating OneSignal.podspec..." + pod spec lint OneSignal.podspec --allow-warnings + + - name: Validate OneSignalXCFramework.podspec + run: | + echo "Validating OneSignalXCFramework.podspec..." + pod spec lint OneSignalXCFramework.podspec --allow-warnings + + - name: Publish OneSignal.podspec to CocoaPods Trunk + run: | + echo "Publishing OneSignal.podspec to CocoaPods Trunk..." + pod trunk push OneSignal.podspec --allow-warnings + + - name: Publish OneSignalXCFramework.podspec to CocoaPods Trunk + run: | + echo "Publishing OneSignalXCFramework.podspec to CocoaPods Trunk..." + pod trunk push OneSignalXCFramework.podspec --allow-warnings + + - name: ✅ CocoaPods Published + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + echo "============================================" + echo "✅ Successfully published version $VERSION to CocoaPods!" + echo "============================================" + echo "📦 OneSignal: https://cocoapods.org/pods/OneSignal" + echo "📦 OneSignalXCFramework: https://cocoapods.org/pods/OneSignalXCFramework" + + - name: Checkout OneSignal-XCFramework + uses: actions/checkout@v4 + with: + repository: OneSignal/OneSignal-XCFramework + ref: ${{ steps.detect_branch.outputs.branch }} + path: xcframework-repo + fetch-depth: 0 + token: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }} + + - name: Get iOS SDK Release Body + id: get_ios_release + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + + # Fetch the release body from OneSignal-iOS-SDK + if gh release view "$VERSION" --repo OneSignal/OneSignal-iOS-SDK --json body --jq '.body' > ios_release_body.md 2>/dev/null; then + echo "✅ Found iOS SDK release for version $VERSION" + echo "found=true" >> $GITHUB_OUTPUT + else + echo "⚠️ No iOS SDK release found for version $VERSION" + echo "found=false" >> $GITHUB_OUTPUT + echo "" > ios_release_body.md + fi + + - name: Create GitHub Release for OneSignal-XCFramework + env: + GH_TOKEN: ${{ secrets.PAT_TOKEN_ONESIGNAL_XCFRAMEWORK }} + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + BRANCH="${{ steps.detect_branch.outputs.branch }}" + + cd xcframework-repo + + # Configure git + git config --local user.email "noreply@onesignal.com" + git config --local user.name "github-actions[bot]" + + # Create and push tag + git tag -a "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" + + echo "✅ Created and pushed tag: $VERSION to OneSignal-XCFramework" + + # Use iOS SDK release body if available, otherwise create default release notes + if [[ "${{ steps.get_ios_release.outputs.found }}" == "true" ]] && [[ -s ../ios_release_body.md ]]; then + echo "Using release notes from iOS SDK release" + cp ../ios_release_body.md release_notes.md + else + echo "No iOS SDK release body found, generating default release notes" + echo "## 🔖 Release $VERSION" > release_notes.md + echo "" >> release_notes.md + echo "This release corresponds to [OneSignal-iOS-SDK $VERSION](https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/$VERSION)" >> release_notes.md + fi + + # Determine if this is a pre-release + PRERELEASE_FLAG="" + if [[ "$VERSION" == *"alpha"* ]] || [[ "$VERSION" == *"beta"* ]]; then + PRERELEASE_FLAG="--prerelease" + echo "Marking as pre-release (alpha/beta detected)" + fi + + # Create GitHub release + gh release create "$VERSION" \ + --repo OneSignal/OneSignal-XCFramework \ + --title "$VERSION" \ + --notes-file release_notes.md \ + --target "$BRANCH" \ + $PRERELEASE_FLAG + + echo "✅ GitHub release created successfully for OneSignal-XCFramework!" + echo "🔗 https://github.com/OneSignal/OneSignal-XCFramework/releases/tag/$VERSION" + + - name: ✅ All Steps Complete + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + echo "============================================" + echo "✅ Successfully completed all release steps for version $VERSION" + echo "============================================" + echo "📦 CocoaPods OneSignal: https://cocoapods.org/pods/OneSignal" + echo "📦 CocoaPods OneSignalXCFramework: https://cocoapods.org/pods/OneSignalXCFramework" + echo "🔗 iOS SDK Release: https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/$VERSION" + echo "🔗 XCFramework Release: https://github.com/OneSignal/OneSignal-XCFramework/releases/tag/$VERSION" From c50217015f4ded7d485c659e9d31781ea20a1803 Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 3 Nov 2025 11:27:31 -0800 Subject: [PATCH 5/8] chore: delete stale workflow files --- .github/release-drafter.yml | 25 ---------------- .github/workflows/release-drafter.yml | 41 --------------------------- 2 files changed, 66 deletions(-) delete mode 100644 .github/release-drafter.yml delete mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 48f81b5af..000000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,25 +0,0 @@ -name-template: $RESOLVED_VERSION -tag-template: $RESOLVED_VERSION -categories: - - title: 🚀 Features - label: Enhancement / Feature - - title: 🐛 Bug Fixes - label: Bug - - title: 🧰 Improvements - label: Improvement -change-template: '- $TITLE (#$NUMBER)' -version-resolver: - major: - labels: - - 'major' - minor: - labels: - - 'minor' - patch: - labels: - - 'patch' - default: patch -template: | - ## Other Changes - - $CHANGES \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 439cae130..000000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Release Drafter - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - main - # pull_request event is required only for autolabeler - pull_request: - # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] - # pull_request_target event is required for autolabeler to support PRs from forks - # pull_request_target: - # types: [opened, reopened, synchronize] - -permissions: - contents: read - -jobs: - update_release_draft: - permissions: - # write permission is required to create a github release - contents: write - # write permission is required for autolabeler - # otherwise, read permission is required at least - pull-requests: write - runs-on: ubuntu-latest - steps: - # (Optional) GitHub Enterprise requires GHE_HOST variable set - #- name: Set GHE_HOST - # run: | - # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV - - # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: release-drafter/release-drafter@v5 - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From cda8bfc654aeed98c1cf10658a624da71f702edf Mon Sep 17 00:00:00 2001 From: Nan Date: Thu, 6 Nov 2025 12:38:42 -0800 Subject: [PATCH 6/8] TESTING only, comment out --- .github/workflows/create-release-prs.yml | 52 ++++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/create-release-prs.yml b/.github/workflows/create-release-prs.yml index bae73be30..dc6fe52a0 100644 --- a/.github/workflows/create-release-prs.yml +++ b/.github/workflows/create-release-prs.yml @@ -103,32 +103,32 @@ jobs: git commit -am "chore: bump version to $VERSION" git push origin $RELEASE_BRANCH - - name: Build Binaries - run: | - cd iOS_SDK/OneSignalSDK - 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 - - - name: Commit Build and Push Changes - run: | - git commit -am "chore: build binaries" - git push origin $RELEASE_BRANCH + # - name: Build Binaries + # run: | + # cd iOS_SDK/OneSignalSDK + # 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 + + # - name: Commit Build and Push Changes + # run: | + # git commit -am "chore: build binaries" + # git push origin $RELEASE_BRANCH - name: Update Swift Package run: | From 924d8b2ec68f986dbd7130af8e3889cd64d89da0 Mon Sep 17 00:00:00 2001 From: Nan Date: Thu, 6 Nov 2025 12:39:06 -0800 Subject: [PATCH 7/8] TESTING only, renamed --- .github/workflows/{create-release-prs.yml => cd.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{create-release-prs.yml => cd.yml} (100%) diff --git a/.github/workflows/create-release-prs.yml b/.github/workflows/cd.yml similarity index 100% rename from .github/workflows/create-release-prs.yml rename to .github/workflows/cd.yml From b2a5b7b24f713325e34145bc1c13d0f99cb81d62 Mon Sep 17 00:00:00 2001 From: Nan Date: Thu, 6 Nov 2025 12:45:30 -0800 Subject: [PATCH 8/8] try new workflow reusable --- .github/workflows/cd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index dc6fe52a0..e63792cec 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -26,9 +26,10 @@ permissions: jobs: # Step 1: Use reusable workflow to prepare release branch prep: - uses: OneSignal/sdk-actions/.github/workflows/prep-release.yml@main + uses: OneSignal/sdk-actions/.github/workflows/prep-release.yml@3baaadcef6da01536c48b9ac2b0c320f43b771c5 with: version: ${{ github.event.inputs.version }} + target_branch: ${{ github.event.inputs.base_branch }} # Step 2: Update iOS-specific files and build binaries update-and-build: @@ -145,11 +146,10 @@ jobs: # Step 3: Use reusable workflow to create iOS SDK PR with release notes create-ios-pr: needs: [prep, update-and-build] - uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main + uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@3baaadcef6da01536c48b9ac2b0c320f43b771c5 with: release_branch: ${{ needs.prep.outputs.release_branch }} - version_from: ${{ needs.update-and-build.outputs.version_from }} - version_to: ${{ github.event.inputs.version }} + target_branch: ${{ github.event.inputs.base_branch }} # Step 4: Update XCFramework repository update-xcframework: