Skip to content

Commit 558dce0

Browse files
committed
ci: create release pr
1 parent 839bb3d commit 558dce0

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Create Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dotnet_version:
7+
description: ".NET / Xamarin release version (e.g., 5.0.0 or 5.0.0-beta1)"
8+
required: true
9+
type: string
10+
ios_sdk_version:
11+
description: "OneSignal iOS SDK version to include (e.g., 5.1.0)"
12+
required: true
13+
type: string
14+
android_sdk_version:
15+
description: "OneSignal Android SDK version to include (e.g., 5.1.0)"
16+
required: true
17+
type: string
18+
19+
jobs:
20+
create-release-pr:
21+
name: Create Release PR
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: '8.0.x'
34+
35+
- name: Setup NuGet
36+
uses: NuGet/setup-nuget@v2
37+
38+
- name: Configure git
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
43+
- name: Create release branch
44+
run: |
45+
BRANCH="rel/${{ inputs.dotnet_version }}"
46+
git checkout -b "$BRANCH"
47+
48+
- name: Update native SDK versions
49+
run: |
50+
echo "Updating iOS SDK version reference to ${{ inputs.ios_sdk_version }}"
51+
echo "Updating Android SDK version reference to ${{ inputs.android_sdk_version }}"
52+
53+
# Example: update constants, props, or metadata that reference SDK versions.
54+
# Adjust these paths/patterns as appropriate for your repo structure.
55+
56+
# iOS SDK version file
57+
if grep -q "ONESIGNAL_IOS_SDK_VERSION" build.props 2>/dev/null; then
58+
sed -i "s/ONESIGNAL_IOS_SDK_VERSION = .*/ONESIGNAL_IOS_SDK_VERSION = \"${{ inputs.ios_sdk_version }}\";/" build.props
59+
fi
60+
61+
# Android SDK version file
62+
if grep -q "ONESIGNAL_ANDROID_SDK_VERSION" build.props 2>/dev/null; then
63+
sed -i "s/ONESIGNAL_ANDROID_SDK_VERSION = .*/ONESIGNAL_ANDROID_SDK_VERSION = \"${{ inputs.android_sdk_version }}\";/" build.props
64+
fi
65+
66+
- name: Update version numbers
67+
run: |
68+
echo "Updating .NET and Xamarin version numbers to ${{ inputs.dotnet_version }}"
69+
70+
# Xamarin version
71+
sed -i "s|<version>.*</version>|<version>${{ inputs.dotnet_version }}</version>|" OneSignalSDK.Xamarin.nuspec
72+
73+
# .NET version
74+
sed -i "s|<version>.*</version>|<version>${{ inputs.dotnet_version }}</version>|" OneSignalSDK.DotNet.nuspec
75+
76+
- name: Build Xamarin
77+
run: |
78+
nuget restore
79+
msbuild OneSignal.sln /t:Rebuild /p:Configuration=Release /p:Version=${{ inputs.dotnet_version }} /p:ReleaseVersion=${{ inputs.dotnet_version }}
80+
81+
- name: Build .NET
82+
run: |
83+
dotnet restore
84+
dotnet build OneSignal.sln /t:Rebuild /p:Configuration=Release /p:Version=${{ inputs.dotnet_version }}
85+
86+
- name: Commit and push release branch
87+
run: |
88+
git add .
89+
git commit -m "chore(release): prepare v${{ inputs.dotnet_version }} (iOS ${{ inputs.ios_sdk_version }}, Android ${{ inputs.android_sdk_version }})"
90+
git push origin HEAD
91+
92+
- name: Create Release PR
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
run: |
96+
TARGET_BRANCH="main"
97+
if [[ "${{ inputs.dotnet_version }}" == *"beta"* ]]; then
98+
TARGET_BRANCH="beta"
99+
fi
100+
101+
gh pr create \
102+
--title "Release v${{ inputs.dotnet_version }}" \
103+
--body "## 📦 Release v${{ inputs.dotnet_version }}
104+
**iOS SDK:** ${{ inputs.ios_sdk_version }}
105+
**Android SDK:** ${{ inputs.android_sdk_version }}
106+
107+
### 📝 iOS Release Notes
108+
${{ inputs.ios_release_notes }}
109+
110+
### 📝 Android Release Notes
111+
${{ inputs.android_release_notes }}
112+
113+
Once approved, merge into \`${TARGET_BRANCH}\` and follow manual steps to publish to NuGet." \
114+
--base "$TARGET_BRANCH" \
115+
--head "rel/${{ inputs.dotnet_version }}" \
116+
--label "release"

0 commit comments

Comments
 (0)