Skip to content

Commit 1d98760

Browse files
authored
ci: Update release workflow (#1600)
* nit(cleanup): remove unused semantic version helpers These methods are unused, leftover dead code. * 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 * 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 * 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 * chore: delete stale workflow files * use updated shared workflows consider target branch * Add warning to Package.swift * For release automation workflow, we copy Package.swift to the XCFramework repository and rename the package name from "OneSignalFramework" to "OneSignalXCFramework". Since there are multiple occurrances of `name: "OneSignalFramework"` in this file, we ONLY want to change line 7! * chore: use ubuntu-latest for upload-assets job The upload-assets job only needs to upload zip files using gh CLI, which works fine on Ubuntu. This saves on macOS runner costs. * chore: auto-trigger create-github-release on release PR merge Change workflow to automatically run when release PRs are merged. - Trigger on pull_request closed event instead of workflow_dispatch - Only run if PR was merged and title contains 'Release' - Support both main and version branches (e.g., 5.3-main) - Use PR base branch for checkout instead of manual input
1 parent 47972a4 commit 1d98760

File tree

12 files changed

+589
-212
lines changed

12 files changed

+589
-212
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/cd.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Create GitHub Release
2+
3+
# This workflow creates a GitHub release in iOS-SDK and attaches the built zip files.
4+
# Runs automatically when a release PR is merged.
5+
6+
on:
7+
pull_request:
8+
types:
9+
- closed
10+
branches:
11+
- main
12+
- '*-main' # Matches version branches like 5.3-main
13+
14+
permissions:
15+
contents: write
16+
pull-requests: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
# Step 1: Extract version from podspec
24+
get-version:
25+
if: |
26+
github.event.pull_request.merged == true &&
27+
contains(github.event.pull_request.title, 'Release')
28+
runs-on: ubuntu-latest
29+
outputs:
30+
version: ${{ steps.extract_version.outputs.version }}
31+
steps:
32+
- name: Checkout OneSignal-iOS-SDK
33+
uses: actions/checkout@v4
34+
with:
35+
ref: ${{ github.event.pull_request.base.ref }}
36+
37+
- name: Extract release version from podspec
38+
id: extract_version
39+
run: |
40+
VERSION=$(grep -E "s.version\s*=" OneSignal.podspec | sed -E 's/.*"(.*)".*/\1/')
41+
echo "version=$VERSION" >> $GITHUB_OUTPUT
42+
echo "Extracted version: $VERSION"
43+
44+
# Step 2: Use reusable workflow to create GitHub release with release notes
45+
create-release:
46+
needs: get-version
47+
uses: OneSignal/sdk-actions/.github/workflows/github-release.yml@main
48+
with:
49+
version: ${{ needs.get-version.outputs.version }}
50+
51+
# Step 3: Upload the 10 xcframework zips to the release
52+
upload-assets:
53+
needs: [get-version, create-release]
54+
runs-on: ubuntu-latest
55+
56+
env:
57+
VERSION: ${{ needs.get-version.outputs.version }}
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
steps:
61+
- name: Checkout OneSignal-iOS-SDK
62+
uses: actions/checkout@v4
63+
with:
64+
ref: ${{ github.event.pull_request.base.ref }}
65+
66+
- name: 📋 Display Configuration
67+
run: |
68+
echo "============================================"
69+
echo "📦 Uploading assets for version: $VERSION"
70+
echo "============================================"
71+
72+
- name: Upload xcframework zips to release
73+
run: |
74+
cd iOS_SDK/OneSignalSDK
75+
76+
gh release upload "$VERSION" \
77+
OneSignalCore.xcframework.zip \
78+
OneSignalExtension.xcframework.zip \
79+
OneSignalFramework.xcframework.zip \
80+
OneSignalInAppMessages.xcframework.zip \
81+
OneSignalLiveActivities.xcframework.zip \
82+
OneSignalLocation.xcframework.zip \
83+
OneSignalNotifications.xcframework.zip \
84+
OneSignalOSCore.xcframework.zip \
85+
OneSignalOutcomes.xcframework.zip \
86+
OneSignalUser.xcframework.zip
87+
88+
echo "✅ All xcframework zips uploaded successfully!"
89+
echo "🔗 https://github.com/${{ github.repository }}/releases/tag/$VERSION"

0 commit comments

Comments
 (0)