Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f3b9c25
ci: create release PR
jinliu9508 Oct 23, 2025
2ad8714
test on the working branch
jinliu9508 Oct 27, 2025
6d6ac00
fix version
jinliu9508 Oct 29, 2025
1f885a5
use buidalon unity setup
jinliu9508 Oct 29, 2025
531d544
add activation
jinliu9508 Nov 4, 2025
31217fa
remove cache
jinliu9508 Nov 4, 2025
6d1f786
update version name
jinliu9508 Nov 4, 2025
29d50f6
remove timeout
jinliu9508 Oct 30, 2025
7cde355
cache unity editor
jinliu9508 Nov 5, 2025
b5b5742
use shared action for creating release PR
jinliu9508 Nov 5, 2025
ea8e38e
clear unity locks
jinliu9508 Nov 5, 2025
3975a72
add build pipeline package
jinliu9508 Nov 6, 2025
a843f7d
Revert "add build pipeline package"
jinliu9508 Nov 6, 2025
7df5e14
remove cache
jinliu9508 Nov 6, 2025
76613a4
Revert "remove cache"
jinliu9508 Nov 6, 2025
7bd4ae0
change editor version
jinliu9508 Nov 6, 2025
ee41a30
Revert "change editor version"
jinliu9508 Nov 6, 2025
a5cca03
silent crashes in executeMethod
jinliu9508 Nov 6, 2025
6be44ff
Revert "silent crashes in executeMethod"
jinliu9508 Nov 6, 2025
d65e6da
update ExternalDependencyManager to 1.2.186
jinliu9508 Nov 6, 2025
f49e096
Revert "update ExternalDependencyManager to 1.2.186"
jinliu9508 Nov 6, 2025
3444e65
resolve unity pacakge
jinliu9508 Nov 6, 2025
fdf9f21
Revert "resolve unity pacakge"
jinliu9508 Nov 6, 2025
0d822b4
disable parallel compilation
jinliu9508 Nov 6, 2025
9920020
use ubuntu
jinliu9508 Nov 6, 2025
08d2719
add github token for drafting release
jinliu9508 Nov 6, 2025
3f3d04f
find package path
jinliu9508 Nov 6, 2025
be09624
add some log
jinliu9508 Nov 6, 2025
e77b30b
debug: find unitypackage
jinliu9508 Nov 7, 2025
b0dcb4f
cleanup: revert change in composeRelease.sh
jinliu9508 Nov 7, 2025
71f9b04
cleanup: use the composed environment setup
jinliu9508 Nov 7, 2025
939d435
Bump Android SDK 5.1.38
github-actions[bot] Nov 7, 2025
dcccb63
Bump iOS SDK 5.2.15
github-actions[bot] Nov 7, 2025
dc1db59
Release 5.2.15
github-actions[bot] Nov 7, 2025
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
26 changes: 26 additions & 0 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Setup Environment'
description: 'Common setup steps for Unity release workflows (Git config and environment prep)'

inputs:
gh_token:
description: 'GitHub token for gh CLI authentication'
required: true

runs:
using: 'composite'
steps:
- name: Configure Git
shell: bash
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

- name: Prepare Environment
env:
GH_TOKEN: ${{ inputs.gh_token }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gh jq || true
gh auth status || gh auth login --with-token <<< "$GH_TOKEN"

262 changes: 262 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
name: Create Unity Release PR

on:
# For making a release pr from android / ios sdk actions
workflow_call:
inputs:
unity_version:
description: 'New Unity Version (e.g., 5.2.15 or 5.2.15-beta.1)'
required: true
type: string
android_version:
description: 'New Android SDK Version (e.g., 2.3.0). Leave blank to skip.'
required: false
type: string
ios_version:
description: 'New iOS SDK Version (e.g., 1.5.0). Leave blank to skip.'
required: false
type: string

# For making a release pr from github actions
workflow_dispatch:
inputs:
unity_version:
description: 'New Unity Version (e.g., 5.2.15 or 5.2.15-beta.1)'
required: true
type: string
android_version:
description: 'New Android SDK Version (e.g., 2.3.0). Leave blank to skip.'
required: false
type: string
ios_version:
description: 'New iOS SDK Version (e.g., 1.5.0). Leave blank to skip.'
required: false
type: string

permissions:
contents: write
pull-requests: write

jobs:
prep:
uses: OneSignal/sdk-actions/.github/workflows/prep-release.yml@main
with:
version: ${{ inputs.unity_version }}

# Unity specific steps
update-version:
needs: prep
runs-on: ubuntu-latest
outputs:
unity_from: ${{ steps.current_versions.outputs.unity_from }}
ios_from: ${{ steps.current_versions.outputs.ios_from }}
android_from: ${{ steps.current_versions.outputs.android_from }}

steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ needs.prep.outputs.release_branch }}

- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}

- name: Get current native SDK versions
id: current_versions
run: |
# Current Unity version
CURRENT_VERSION=$(cat OneSignalExample/Assets/OneSignal/VERSION | tr -d '\n\r' | xargs)

# Extract current Android SDK version
ANDROID_VERSION=$(grep -oE 'spec="com.onesignal:OneSignal:[0-9]+\.[0-9]+\.[0-9]+"' com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml | sed -E 's/.*OneSignal:([0-9]+\.[0-9]+\.[0-9]+)".*/\1/' | head -1)

# Extract current iOS SDK version
IOS_VERSION=$(grep -oE 'version="[0-9.]+"' com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml | grep -oE '[0-9.]+' | head -1)

echo "unity_from=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
echo "android_from=${ANDROID_VERSION}" >> $GITHUB_OUTPUT
echo "ios_from=${IOS_VERSION}" >> $GITHUB_OUTPUT

echo " unity_from: ${CURRENT_VERSION}"
echo " android_from: ${ANDROID_VERSION}"
echo " ios_from: ${IOS_VERSION}"

- name: Update Android SDK version
if: inputs.android_version != ''
run: |
VERSION="${{ inputs.android_version }}"

# Validate version exists on GitHub
RELEASE=$(curl -s -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/OneSignal/OneSignal-Android-SDK/releases/tags/${VERSION}")

if [ -z "$RELEASE" ]; then
echo "✗ Android SDK version ${VERSION} not found"
exit 1
fi

sed -i -E "s/spec=\"com\.onesignal:OneSignal:[0-9][0-9.]*\"/spec=\"com.onesignal:OneSignal:$VERSION\"/" com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml
sed -i -E "s/'com\.onesignal:OneSignal:[0-9][0-9.]*'/'com.onesignal:OneSignal:$VERSION'/" OneSignalExample/Assets/Plugins/Android/mainTemplate.gradle
sed -i -E "s/<package>com\.onesignal:OneSignal:[0-9][0-9.]*<\/package>/<package>com.onesignal:OneSignal:$VERSION<\/package>/" OneSignalExample/ProjectSettings/AndroidResolverDependencies.xml

echo "✓ Updated Android SDK to ${VERSION}"
git add .
git commit -m "Bump Android SDK $VERSION"
git push

- name: Update iOS SDK version
if: inputs.ios_version != ''
run: |
VERSION="${{ inputs.ios_version }}"

# Validate version exists on GitHub
RELEASE=$(curl -s -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/OneSignal/OneSignal-iOS-SDK/releases/tags/${VERSION}")

if [ -z "$RELEASE" ]; then
echo "✗ iOS SDK version ${VERSION} not found"
exit 1
fi

sed -i -E "s/version=\"[0-9][0-9.]*\"/version=\"$VERSION\"/" com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml

echo "✓ Updated iOS SDK to ${VERSION}"
git add .
git commit -m "Bump iOS SDK $VERSION"
git push

create-pr:
needs: [prep, update-version]
uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main
with:
release_branch: ${{ needs.prep.outputs.release_branch }}
version_from: ${{ needs.update-version.outputs.unity_from }}
version_to: ${{ inputs.unity_version }}
android_from: ${{ needs.update-version.outputs.android_from }}
android_to: ${{ inputs.android_version }}
ios_from: ${{ needs.update-version.outputs.ios_from }}
ios_to: ${{ inputs.ios_version }}

draft-release:
needs: [prep, update-version]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ needs.prep.outputs.release_branch }}

- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}

- name: Update Unity SDK version
run: |
echo "Updating Unity SDK version to ${{ inputs.unity_version }}"

# Version string formats
PADDED_VERSION=$(printf "%06d" $(echo "${{ inputs.unity_version }}" | sed 's/[^0-9]//g'))

# VERSION file
echo "${{ inputs.unity_version }}" > OneSignalExample/Assets/OneSignal/VERSION

# package.json files
for file in com.onesignal.unity.core/package.json com.onesignal.unity.android/package.json com.onesignal.unity.ios/package.json; do
sed -i "s/\"version\": \".*\"/\"version\": \"${{ inputs.unity_version }}\"/" "$file"
sed -i "s/\"com.onesignal.unity.core\": \".*\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/" "$file"
done

sed -i "s/public const string Version = \".*\"/public const string Version = \"${{ inputs.unity_version }}\"/" \
com.onesignal.unity.core/Runtime/OneSignal.cs
sed -i "s/public const string VersionHeader = \".*\"/public const string VersionHeader = \"${PADDED_VERSION}\"/" \
com.onesignal.unity.core/Runtime/OneSignalPlatform.cs

# asmdef files
for asm in \
OneSignalExample/Assets/OneSignal/Example/OneSignal.UnityPackage.Example.asmdef \
OneSignalExample/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef \
OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef; do
sed -i "s/\"expression\": \".*\"/\"expression\": \"${{ inputs.unity_version }}\"/" "$asm"
done

# packages-lock.json
sed -i "s/\"com.onesignal.unity.core\": \"[0-9.]\+\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/g" \
OneSignalExample/Packages/packages-lock.json

# ProjectSettings.asset
sed -i "s/bundleVersion: .*/bundleVersion: ${{ inputs.unity_version }}/" \
OneSignalExample/ProjectSettings/ProjectSettings.asset

# iOS plugin version (UIApplication+OneSignalUnity.mm)
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" \
com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm

# to save time, use cached Unity installation if available
- name: Cache Unity
uses: actions/cache@v4
with:
path: /home/runner/Unity/Hub
key: UnityEditor-${{ runner.os }}
restore-keys: |
UnityEditor-${{ runner.os }}

# setup Unity using the version file
- name: Setup Unity
uses: buildalon/[email protected]
with:
version-file: 'OneSignalExample/ProjectSettings/ProjectVersion.txt'

# need to activate the Unity license to run Unity in batchmode; required for exportPackage
- uses: buildalon/activate-unity-license@v2
with:
license: 'Personal'
username: '${{ secrets.UNITY_USERNAME }}'
password: '${{ secrets.UNITY_PASSWORD }}'

- name: Cleaning up Unity locks
run: |
pkill -f Unity || true
rm -f OneSignalExample/Temp/UnityLockfile
rm -rf OneSignalExample/Library OneSignalExample/Temp OneSignalExample/obj OneSignalExample/UserSettings || true

- name: Run UpdateProjectVersion
uses: buildalon/unity-action@v3
with:
project-path: OneSignalExample
args: -quit -batchmode -nographics -buildTarget Android -executeMethod OneSignalSDK.OneSignalPackagePublisher.UpdateProjectVersion

- name: Run ExportUnityPackage
uses: buildalon/unity-action@v3
with:
project-path: OneSignalExample
args: -quit -batchmode -nographics -buildTarget Android -executeMethod OneSignalSDK.OneSignalPackagePublisher.ExportUnityPackage

- name: Commit Release
run: |
git add .
git commit -m "Release ${{ inputs.unity_version }}"
git push

- name: Debug — list Unity package files
run: |
echo "Current working directory:"
pwd
echo ""
echo "List of all files under OneSignalExample:"
ls -Rlh OneSignalExample || true
echo ""
echo "Searching for .unitypackage files:"
find OneSignalExample -type f -name "*.unitypackage" -print

- name: Draft Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
package_path="OneSignalExample/OneSignal-v${{ inputs.unity_version }}.unitypackage"
gh release create "${{ inputs.unity_version }}" "${package_path}"\
--draft\
--title "${{ inputs.unity_version }} Release"\
--notes "TODO"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"versionDefines": [
{
"name": "com.onesignal.unity.core",
"expression": "5.1.15",
"expression": "5.2.15",
"define": "ONE_SIGNAL_INSTALLED"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"versionDefines": [
{
"name": "com.onesignal.unity.core",
"expression": "5.1.15",
"expression": "5.2.15",
"define": "ONE_SIGNAL_INSTALLED"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"versionDefines": [
{
"name": "com.onesignal.unity.core",
"expression": "5.1.15",
"expression": "5.2.15",
"define": "ONE_SIGNAL_INSTALLED"
}
],
Expand Down
2 changes: 1 addition & 1 deletion OneSignalExample/Assets/OneSignal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.15
5.2.15
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,24 @@ public static void UpdateProjectVersion()
[MenuItem("OneSignal/ExportUnityPackage")]
public static void ExportUnityPackage()
{
UnityEngine.Debug.Log($"[OneSignalPackagePublisher] start exporting package");
AssetDatabase.Refresh();
var packageVersion = File.ReadAllText(VersionFilePath);
var packageName = $"OneSignal-v{packageVersion}.unitypackage";

UnityEngine.Debug.Log($"[OneSignalPackagePublisher] package name: {packageName}");

string[] filePaths = _filePaths();
UnityEngine.Debug.Log(
$"[OneSignalPackagePublisher] Found {filePaths.Length} files/directories to include:"
);
foreach (var path in filePaths)
{
UnityEngine.Debug.Log($"[OneSignalPackagePublisher] - {path}");
}

AssetDatabase.ExportPackage(
_filePaths(),
filePaths,
packageName,
ExportPackageOptions.Recurse | ExportPackageOptions.IncludeDependencies
);
Expand All @@ -68,6 +80,9 @@ public static void ExportUnityPackage()
private static string[] _filePaths()
{
var files = Directory.GetFileSystemEntries(PackagePath);
UnityEngine.Debug.Log(
$"[OneSignalPackagePublisher] Getting file paths from: {PackagePath}"
);
var pathsToInclude = files.Where(file =>
{
if (file.EndsWith(".meta"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'com.onesignal:OneSignal:5.1.37' // Packages/com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml:6
implementation 'com.onesignal:OneSignal:5.1.38' // Packages/com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml:6
// Android Resolver Dependencies End
**DEPS**}

Expand Down
1 change: 1 addition & 0 deletions OneSignalExample/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.5",
"com.unity.toolchain.linux-x86_64": "2.0.11",
"com.unity.toolchain.macos-x86_64-linux-x86_64": "2.0.4",
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.4",
"com.unity.ugui": "1.0.0",
Expand Down
Loading