Repository navigation
283 lines (263 loc) · 9.29 KB
/
Copy pathcreate-wrapper-prs.yml
File metadata and controls
283 lines (263 loc) · 9.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Create Wrapper PRs
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch: # For testing, try to avoid using this
inputs:
android_version:
required: false
type: string
description: The Android SDK version to update to
ios_version:
required: false
type: string
description: The iOS SDK version to update to
version_bump:
type: choice
default: patch
description: Version bump type for wrapper SDKs
options:
- patch
- minor
capacitor:
type: boolean
default: true
description: Update Capacitor SDK
cordova:
type: boolean
default: true
description: Update Cordova SDK
flutter:
type: boolean
default: true
description: Update Flutter SDK
react_native:
type: boolean
default: true
description: Update React Native SDK
unity:
type: boolean
default: true
description: Update Unity SDK
dotnet:
type: boolean
default: true
description: Update .NET SDK
workflow_call:
inputs:
android_version:
required: false
type: string
description: The Android SDK version to update to
ios_version:
required: false
type: string
description: The iOS SDK version to update to
capacitor:
type: boolean
required: false
default: true
description: Update Capacitor SDK
cordova:
type: boolean
required: false
default: true
description: Update Cordova SDK
flutter:
type: boolean
required: false
default: true
description: Update Flutter SDK
react_native:
type: boolean
required: false
default: true
description: Update React Native SDK
unity:
type: boolean
required: false
default: true
description: Update Unity SDK
dotnet:
type: boolean
required: false
default: true
description: Update .NET SDK
version_bump:
type: string
required: false
default: patch
description: Version bump type for wrapper SDKs (patch or minor)
secrets:
GH_PUSH_TOKEN:
required: false
description: GitHub token with push permissions
jobs:
validate-inputs:
runs-on: ubuntu-latest
steps:
- name: Validate at least one input provided
if: github.event_name == 'workflow_call'
run: |
if [[ -z "${{ inputs.android_version }}" && -z "${{ inputs.ios_version }}" ]]; then
echo "❌ Error: At least one of 'android_version' or 'ios_version' must be provided"
exit 1
fi
echo "✓ Input validation passed"
- name: Skip pre-release versions
run: |
ANDROID="${{ inputs.android_version }}"
IOS="${{ inputs.ios_version }}"
if [[ "$ANDROID" =~ (alpha|beta) ]]; then
echo "⏭️ Skipping: Android version '$ANDROID' is a pre-release"
exit 1
fi
if [[ "$IOS" =~ (alpha|beta) ]]; then
echo "⏭️ Skipping: iOS version '$IOS' is a pre-release"
exit 1
fi
echo "✓ No pre-release versions detected"
wait-for-android-artifact:
# Maven Central propagation lags behind publishToMavenCentral by minutes
# to hours. Block wrapper PR fan-out until the OneSignal Android SDK pom
# is resolvable from repo1.maven.org so downstream wrapper e2e builds do
# not fail with "Could not find com.onesignal:OneSignal:X.Y.Z" against a
# stale mirror. Always runs (no job-level if) so iOS-only invocations
# still satisfy the downstream needs: dependency; the steps no-op when
# android_version is empty.
needs: validate-inputs
runs-on: ubuntu-latest
steps:
- name: Skip when iOS-only
if: inputs.android_version == ''
run: echo "No android_version provided; skipping Maven propagation wait."
- uses: actions/checkout@v6
if: inputs.android_version != ''
with:
repository: OneSignal/sdk-shared
ref: main
sparse-checkout: |
.github/actions/wait-for-maven-artifact
- uses: ./.github/actions/wait-for-maven-artifact
if: inputs.android_version != ''
with:
version: ${{ inputs.android_version }}
wait-for-ios-pod:
# CocoaPods CDN propagation can lag behind pod publish. Block wrapper PR
# fan-out until both the version shard and podspec JSON are visible so
# downstream iOS builds do not fail resolving OneSignalXCFramework.
# Always runs so Android-only invocations still satisfy downstream needs.
needs: validate-inputs
runs-on: ubuntu-latest
steps:
- name: Skip when Android-only
if: inputs.ios_version == ''
run: echo "No ios_version provided; skipping CocoaPods propagation wait."
- uses: actions/checkout@v6
if: inputs.ios_version != ''
with:
repository: OneSignal/sdk-shared
ref: main
sparse-checkout: |
.github/actions/wait-for-cocoapods-pod
- uses: ./.github/actions/wait-for-cocoapods-pod
if: inputs.ios_version != ''
with:
version: ${{ inputs.ios_version }}
versions:
needs: [validate-inputs, wait-for-android-artifact, wait-for-ios-pod]
runs-on: ubuntu-latest
outputs:
capacitor: ${{ steps.versions.outputs.capacitor }}
cordova: ${{ steps.versions.outputs.cordova }}
flutter: ${{ steps.versions.outputs.flutter }}
react_native: ${{ steps.versions.outputs.react-native }}
unity: ${{ steps.versions.outputs.unity }}
dotnet: ${{ steps.versions.outputs.dotnet }}
steps:
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun i -g semver
- name: Get latest SDK releases
id: versions
run: |
# Define SDK to repo mapping
declare -A SDK_REPOS=(
["capacitor"]="OneSignal/OneSignal-Capacitor-SDK"
["cordova"]="OneSignal/OneSignal-Cordova-SDK"
["flutter"]="OneSignal/OneSignal-Flutter-SDK"
["react-native"]="OneSignal/react-native-onesignal"
["unity"]="OneSignal/OneSignal-Unity-SDK"
["dotnet"]="OneSignal/OneSignal-DotNet-SDK"
)
for SDK in "${!SDK_REPOS[@]}"; do
REPO="${SDK_REPOS[$SDK]}"
# Get latest stable version (exclude pre-releases)
LATEST_VERSION=$(gh release list --repo "$REPO" --limit 20 --json tagName,isPrerelease | jq -r '.[] | select(.isPrerelease == false) | .tagName' | head -1 || echo "")
NEW_VERSION=$(semver "$LATEST_VERSION" -i "${{ inputs.version_bump || 'patch' }}")
echo "$SDK=$NEW_VERSION" >> $GITHUB_OUTPUT
done
env:
GH_TOKEN: ${{ secrets.GH_PUSH_TOKEN || github.token }}
capacitor-release:
needs: [versions]
if: inputs.capacitor != false
uses: OneSignal/OneSignal-Capacitor-SDK/.github/workflows/create-release-pr.yml@main
secrets:
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
with:
capacitor_version: ${{ needs.versions.outputs.capacitor }}
android_version: ${{ inputs.android_version }}
ios_version: ${{ inputs.ios_version }}
cordova-release:
needs: [versions]
if: inputs.cordova != false
uses: OneSignal/OneSignal-Cordova-SDK/.github/workflows/create-release-pr.yml@main
secrets:
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
with:
cordova_version: ${{ needs.versions.outputs.cordova }}
android_version: ${{ inputs.android_version }}
ios_version: ${{ inputs.ios_version }}
flutter-release:
needs: [versions]
if: inputs.flutter != false
uses: OneSignal/OneSignal-Flutter-SDK/.github/workflows/create-release-pr.yml@main
secrets:
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
with:
flutter_version: ${{ needs.versions.outputs.flutter }}
android_version: ${{ inputs.android_version }}
ios_version: ${{ inputs.ios_version }}
react-native-release:
needs: [versions]
if: inputs.react_native != false
uses: OneSignal/react-native-onesignal/.github/workflows/create-release-pr.yml@main
secrets:
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
with:
rn_version: ${{ needs.versions.outputs.react_native }}
android_version: ${{ inputs.android_version }}
ios_version: ${{ inputs.ios_version }}
unity-release:
needs: [versions]
if: inputs.unity != false
uses: OneSignal/OneSignal-Unity-SDK/.github/workflows/create-release-pr.yml@main
secrets:
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
with:
unity_version: ${{ needs.versions.outputs.unity }}
android_version: ${{ inputs.android_version }}
ios_version: ${{ inputs.ios_version }}
dotnet-release:
needs: [versions]
if: inputs.dotnet != false
uses: OneSignal/OneSignal-DotNet-SDK/.github/workflows/create-release-pr.yml@main
secrets:
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
with:
dotnet_version: ${{ needs.versions.outputs.dotnet }}
android_version: ${{ inputs.android_version }}
ios_version: ${{ inputs.ios_version }}