From f3b9c25632a46f6e4fa3ffdd8eaf16d2eae8b776 Mon Sep 17 00:00:00 2001 From: jinliu9508 Date: Thu, 23 Oct 2025 13:32:35 -0400 Subject: [PATCH 1/4] ci: create release PR --- .github/workflows/create-release-pr.yml | 110 ++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/create-release-pr.yml diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 000000000..03e682d7e --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -0,0 +1,110 @@ +name: Create Unity Release PR + +on: + workflow_dispatch: + inputs: + version: + description: 'New Unity SDK version (e.g. 5.4.0-alpha01 or 3.2.1)' + type: string + required: true + base_branch: + description: 'Target branch for the PR (e.g. main for regular releases, 5.4-main for patch releases)' + type: string + required: false + default: 'main' + +permissions: + contents: write + pull-requests: write + +jobs: + create-unity-release: + runs-on: ubuntu-latest + + env: + VERSION: ${{ github.event.inputs.version }} + BASE_BRANCH: ${{ github.event.inputs.base_branch || 'main' }} + BRANCH: release/${{ github.event.inputs.version }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: ๐Ÿ“‹ Display Configuration + run: | + echo "============================================" + echo "๐ŸŽฎ Creating Unity SDK Release" + echo "๐Ÿ“ฆ Version: $VERSION" + echo "๐ŸŽฏ Base Branch (PR Target): $BASE_BRANCH" + echo "๐ŸŒฟ Release Branch (to create): $BRANCH" + echo "============================================" + + - name: โœ… Validate Base Branch + run: | + if [[ "$BASE_BRANCH" == "main" ]]; then + echo "โœ… Valid base branch: main" + elif [[ "$BASE_BRANCH" =~ ^[0-9]+\.[0-9]+-main$ ]]; then + echo "โœ… Valid base branch: $BASE_BRANCH" + else + echo "โŒ ERROR: Invalid base branch '$BASE_BRANCH'" + echo "" + echo "Base branch must be either:" + echo " - 'main' (for regular releases)" + echo " - 'X.Y-main' (for patch lines, e.g., 5.4-main)" + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Create release branch from base + run: | + if git ls-remote --exit-code --heads origin "$BRANCH"; then + echo "Deleting remote branch $BRANCH" + git push origin --delete "$BRANCH" + fi + + echo "Creating release branch $BRANCH from $BASE_BRANCH" + git checkout -b "$BRANCH" origin/$BASE_BRANCH + + - name: Run composeRelease.sh + run: | + chmod +x ./composeRelease.sh + ./composeRelease.sh $VERSION + shell: bash + + - name: Commit and Push version bump + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + if git diff --quiet; then + echo "No version changes detected." + else + git commit -am "chore(release): prepare Unity SDK v$VERSION" + git push origin "$BRANCH" + fi + + - name: Generate PR Body + run: | + echo "## ๐ŸŽฎ Unity SDK Release v$VERSION" > pr_body.md + echo "" >> pr_body.md + echo "**Summary:**" >> pr_body.md + echo "- Automated release PR created by CI." >> pr_body.md + echo "- Includes version bumps and changelog updates performed by composeRelease.sh." >> pr_body.md + echo "" >> pr_body.md + echo "**Next Steps:**" >> pr_body.md + echo "1. Review and approve this PR." >> pr_body.md + echo "2. Merge into \`$BASE_BRANCH\`." >> pr_body.md + echo "3. Verify the generated draft GitHub release and attach the updated *.unitypackage if needed." >> pr_body.md + echo "" >> pr_body.md + echo "_This PR was auto-generated by create-unity-release CI._" >> pr_body.md + + - name: Create Pull Request + run: | + gh pr create \ + --title "Release Unity SDK v$VERSION" \ + --body-file pr_body.md \ + --head "$BRANCH" \ + --base "$BASE_BRANCH" From 2ad8714c891d0920f094725e5e7cb52cc55a0eae Mon Sep 17 00:00:00 2001 From: jinliu9508 Date: Mon, 27 Oct 2025 14:23:41 -0400 Subject: [PATCH 2/4] test on the working branch --- .github/workflows/create-release-pr.yml | 302 ++++++++++++++++++------ 1 file changed, 232 insertions(+), 70 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 03e682d7e..6d1e5def1 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -1,63 +1,49 @@ name: Create Unity Release PR on: + push: + branches: + - "ci-unity" workflow_dispatch: inputs: - version: - description: 'New Unity SDK version (e.g. 5.4.0-alpha01 or 3.2.1)' - type: string + release-type: + description: "Release type" required: true - base_branch: - description: 'Target branch for the PR (e.g. main for regular releases, 5.4-main for patch releases)' - type: string - required: false - default: 'main' + default: "stable" + type: choice + options: + - Current + - Beta + - Alpha + permissions: contents: write pull-requests: write jobs: - create-unity-release: + bump-version: runs-on: ubuntu-latest - env: - VERSION: ${{ github.event.inputs.version }} - BASE_BRANCH: ${{ github.event.inputs.base_branch || 'main' }} - BRANCH: release/${{ github.event.inputs.version }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: ๐Ÿ“‹ Display Configuration - run: | - echo "============================================" - echo "๐ŸŽฎ Creating Unity SDK Release" - echo "๐Ÿ“ฆ Version: $VERSION" - echo "๐ŸŽฏ Base Branch (PR Target): $BASE_BRANCH" - echo "๐ŸŒฟ Release Branch (to create): $BRANCH" - echo "============================================" - - - name: โœ… Validate Base Branch - run: | - if [[ "$BASE_BRANCH" == "main" ]]; then - echo "โœ… Valid base branch: main" - elif [[ "$BASE_BRANCH" =~ ^[0-9]+\.[0-9]+-main$ ]]; then - echo "โœ… Valid base branch: $BASE_BRANCH" - else - echo "โŒ ERROR: Invalid base branch '$BASE_BRANCH'" - echo "" - echo "Base branch must be either:" - echo " - 'main' (for regular releases)" - echo " - 'X.Y-main' (for patch lines, e.g., 5.4-main)" - exit 1 - fi - - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 fetch-tags: true + + - name: Get current SDK version + id: current_version + run: | + CURRENT_VERSION=$(grep "bundleVersion:" ProjectSettings/ProjectSettings.asset | sed 's/.*bundleVersion: //') + echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT + - name: Get last release commit + id: last_commit + run: | + LAST_RELEASE_DATE=$(git show -s --format=%cI "${{ steps.current_version.outputs.current }}") + echo "date=$LAST_RELEASE_DATE" >> $GITHUB_OUTPUT + - name: Create release branch from base run: | if git ls-remote --exit-code --heads origin "$BRANCH"; then @@ -65,46 +51,222 @@ jobs: git push origin --delete "$BRANCH" fi - echo "Creating release branch $BRANCH from $BASE_BRANCH" - git checkout -b "$BRANCH" origin/$BASE_BRANCH + echo "Creating release branch $BRANCH from main" + git checkout -b "$BRANCH" origin/main + + - name: Get merged PRs since last release + id: get_prs + uses: actions/github-script@v8 + with: + script: | + const lastReleaseDate = '${{ steps.last_commit.outputs.date }}'; + + // Get merged PRs + const { data: prs } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed', + base: 'main', + per_page: 100 + }); + + // Filter and process PRs + const mergedPrs = prs + .filter(pr => pr.merged_at && new Date(pr.merged_at) > new Date(lastReleaseDate)) + .map(pr => ({ + number: pr.number, + title: pr.title, + })); + core.setOutput('prs', JSON.stringify(mergedPrs)); + + const hasFeatures = mergedPrs.some(pr => /^feat/i.test(pr.title)); + core.setOutput('isFeature', hasFeatures); + + - name: Calculate new version + id: new_version + run: | + CURRENT="${{ steps.current_version.outputs.current }}" + RELEASE_TYPE="${{ inputs.release-type }}" + IS_FEATURE='${{ steps.get_prs.outputs.isFeature }}' + + # Extract base version and determine current pre-release type + if [[ "$CURRENT" =~ -alpha\. ]]; then + BASE_VERSION="${CURRENT%-alpha.*}" + PRERELEASE_NUM="${CURRENT##*-alpha.}" + PRERELEASE_TYPE="alpha" + elif [[ "$CURRENT" =~ -beta\. ]]; then + BASE_VERSION="${CURRENT%-beta.*}" + PRERELEASE_NUM="${CURRENT##*-beta.}" + PRERELEASE_TYPE="beta" + else + BASE_VERSION="$CURRENT" + PRERELEASE_TYPE="stable" + fi + + # Helper function to bump version + bump_version() { + local base=$1 + local is_feature=$2 + local major=${base:0:2} + local minor=${base:2:2} + local patch=${base:4:2} + + if [[ "$is_feature" == "true" ]]; then + minor=$(printf "%02d" $((10#$minor + 1))) + patch="00" + else + patch=$(printf "%02d" $((10#$patch + 1))) + fi + + echo "${major}${minor}${patch}" + } + + # Determine new version based on current and desired release types + if [[ "$RELEASE_TYPE" == "Alpha" ]]; then + if [[ "$PRERELEASE_TYPE" == "alpha" ]]; then + # Increment alpha number + NEW_VERSION="$BASE_VERSION-alpha.$((PRERELEASE_NUM + 1))" + else + # New alpha release from stable or beta + NEW_VERSION="$(bump_version "$BASE_VERSION" "$IS_FEATURE")-alpha.1" + fi + elif [[ "$RELEASE_TYPE" == "Beta" ]]; then + if [[ "$PRERELEASE_TYPE" == "beta" ]]; then + # Increment beta number + NEW_VERSION="$BASE_VERSION-beta.$((PRERELEASE_NUM + 1))" + elif [[ "$PRERELEASE_TYPE" == "alpha" ]]; then + # Promote alpha to beta + NEW_VERSION="$BASE_VERSION-beta.1" + else + # New beta release from stable + NEW_VERSION="$(bump_version "$BASE_VERSION" "$IS_FEATURE")-beta.1" + fi + else + # Release type is Current (stable) + if [[ "$PRERELEASE_TYPE" != "stable" ]]; then + # Promote pre-release to stable + NEW_VERSION="$BASE_VERSION" + else + # Bump stable version + NEW_VERSION="$(bump_version "$CURRENT" "$IS_FEATURE")" + fi + fi + + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT + + - name: Create release branch + run: | + git checkout -b rel/${{ steps.new_version.outputs.version }} + git push -u origin rel/${{ steps.new_version.outputs.version }} + - name: Create temp branch + if: inputs.release-type == 'Alpha' || inputs.release-type == 'Beta' + run: | + git checkout -b release-${{ steps.new_version.outputs.version }} + git push -u origin release-${{ steps.new_version.outputs.version }} + + # Unity specific steps - name: Run composeRelease.sh run: | chmod +x ./composeRelease.sh ./composeRelease.sh $VERSION shell: bash - - name: Commit and Push version bump + - name: Check native SDK version changes + id: native_deps run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + # Get the current plugin.xml + CURRENT_PLUGIN=$(cat plugin.xml) - if git diff --quiet; then - echo "No version changes detected." - else - git commit -am "chore(release): prepare Unity SDK v$VERSION" - git push origin "$BRANCH" + # Extract current Android SDK version + ANDROID_VERSION=$(echo "$CURRENT_PLUGIN" | grep -oP 'com\.onesignal:OneSignal:\K[0-9.]+' | head -1) + + # Extract current iOS SDK version + IOS_VERSION=$(echo "$CURRENT_PLUGIN" | grep -oP 'OneSignalXCFramework.*spec="\K[0-9.]+' | head -1) + + # Get previous plugin.xml from HEAD~1 (before the commit we just made) + PREVIOUS_PLUGIN=$(git show HEAD~1:plugin.xml) + + # Extract previous Android SDK version + PREVIOUS_ANDROID=$(echo "$PREVIOUS_PLUGIN" | grep -oP 'com\.onesignal:OneSignal:\K[0-9.]+' | head -1) + + # Extract previous iOS SDK version + PREVIOUS_IOS=$(echo "$PREVIOUS_PLUGIN" | grep -oP 'OneSignalXCFramework.*spec="\K[0-9.]+' | head -1) + + # Build output for native dependency changes + NATIVE_UPDATES="" + if [[ "$ANDROID_VERSION" != "$PREVIOUS_ANDROID" && ! -z "$PREVIOUS_ANDROID" ]]; then + printf -v NATIVE_UPDATES '%sANDROID_UPDATE=true\nANDROID_FROM=%s\nANDROID_TO=%s\n' "$NATIVE_UPDATES" "$PREVIOUS_ANDROID" "$ANDROID_VERSION" fi - - name: Generate PR Body - run: | - echo "## ๐ŸŽฎ Unity SDK Release v$VERSION" > pr_body.md - echo "" >> pr_body.md - echo "**Summary:**" >> pr_body.md - echo "- Automated release PR created by CI." >> pr_body.md - echo "- Includes version bumps and changelog updates performed by composeRelease.sh." >> pr_body.md - echo "" >> pr_body.md - echo "**Next Steps:**" >> pr_body.md - echo "1. Review and approve this PR." >> pr_body.md - echo "2. Merge into \`$BASE_BRANCH\`." >> pr_body.md - echo "3. Verify the generated draft GitHub release and attach the updated *.unitypackage if needed." >> pr_body.md - echo "" >> pr_body.md - echo "_This PR was auto-generated by create-unity-release CI._" >> pr_body.md - - - name: Create Pull Request + if [[ "$IOS_VERSION" != "$PREVIOUS_IOS" && ! -z "$PREVIOUS_IOS" ]]; then + printf -v NATIVE_UPDATES '%sIOS_UPDATE=true\nIOS_FROM=%s\nIOS_TO=%s\n' "$NATIVE_UPDATES" "$PREVIOUS_IOS" "$IOS_VERSION" + fi + + # Output the variables + echo "$NATIVE_UPDATES" >> $GITHUB_OUTPUT + + - name: Generate release notes + id: release_notes + uses: actions/github-script@v8 + with: + script: | + // Trim whitespace from PR titles + const prs = JSON.parse('${{ steps.get_prs.outputs.prs }}').map(pr => ({ + ...pr, + title: pr.title.trim() + })); + + // Categorize PRs + const features = prs.filter(pr => /^feat/i.test(pr.title)); + const fixes = prs.filter(pr => /^fix/i.test(pr.title)); + const improvements = prs.filter(pr => /^(perf|refactor|chore)/i.test(pr.title)); + + // Helper function to build section + const buildSection = (title, prs) => { + if (prs.length === 0) return ''; + let section = `### ${title}\n\n`; + prs.forEach(pr => { + section += `- ${pr.title} (#${pr.number})\n`; + }); + return section + '\n'; + }; + + let releaseNotes = `Channels: ${{ inputs.release-type }}\n\n`; + releaseNotes += buildSection('๐Ÿš€ New Features', features); + releaseNotes += buildSection('๐Ÿ› Bug Fixes', fixes); + releaseNotes += buildSection('โœจ Improvements', improvements); + + // Check for native dependency changes + const hasAndroidUpdate = '${{ steps.native_deps.outputs.ANDROID_UPDATE }}' === 'true'; + const hasIosUpdate = '${{ steps.native_deps.outputs.IOS_UPDATE }}' === 'true'; + + if (hasAndroidUpdate || hasIosUpdate) { + releaseNotes += '\n### ๐Ÿ› ๏ธ Native Dependency Updates\n\n'; + if (hasAndroidUpdate) { + releaseNotes += `- Update Android SDK from ${{ steps.native_deps.outputs.ANDROID_FROM }} to ${{ steps.native_deps.outputs.ANDROID_TO }}\n`; + releaseNotes += `- See [release notes](https://github.com/OneSignal/OneSignal-Android-SDK/releases) for full details\n`; + } + if (hasIosUpdate) { + releaseNotes += `- Update iOS SDK from ${{ steps.native_deps.outputs.IOS_FROM }} to ${{ steps.native_deps.outputs.IOS_TO }}\n`; + releaseNotes += `- See [release notes](https://github.com/OneSignal/OneSignal-iOS-SDK/releases) for full details\n`; + } + releaseNotes += '\n'; + } + + core.setOutput('notes', releaseNotes); + + - name: Create release PR run: | + NEW_VERSION="${{ steps.new_version.outputs.version }}" + + # Write release notes to file to avoid shell interpretation + cat > release_notes.md << 'EOF' + ${{ steps.release_notes.outputs.notes }} + EOF + gh pr create \ - --title "Release Unity SDK v$VERSION" \ - --body-file pr_body.md \ - --head "$BRANCH" \ - --base "$BASE_BRANCH" + --title "Release $NEW_VERSION" \ + --body-file release_notes.md \ + --base main \ + --reviewer jkasten2 From 0fe1650141d40502da7cf4408a4f04d7240bc7e9 Mon Sep 17 00:00:00 2001 From: jinliu9508 Date: Tue, 28 Oct 2025 23:55:11 -0400 Subject: [PATCH 3/4] fix version --- .github/workflows/create-release-pr.yml | 310 +++++++----------------- 1 file changed, 83 insertions(+), 227 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 6d1e5def1..57954c37d 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -1,272 +1,128 @@ name: Create Unity Release PR on: - push: - branches: - - "ci-unity" workflow_dispatch: inputs: - release-type: - description: "Release type" + bump_command: + description: "Version bump type (major, minor, patch, specify)" required: true - default: "stable" type: choice options: - - Current - - Beta - - Alpha - + - major + - minor + - patch + - specify + postfix: + description: "Optional postfix (e.g. preview, beta, or specific version when using 'specify')" + required: false + type: string permissions: contents: write pull-requests: write jobs: - bump-version: + compose-unity-release: + name: Compose Unity Release runs-on: ubuntu-latest + timeout-minutes: 30 + + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BUMP_COMMAND: ${{ github.event.inputs.bump_command }} + POSTFIX: ${{ github.event.inputs.postfix }} steps: - - name: Checkout repository - uses: actions/checkout@v5 + - name: ๐Ÿ“ฆ Checkout Repository + uses: actions/checkout@v4 with: fetch-depth: 0 fetch-tags: true - - - name: Get current SDK version - id: current_version - run: | - CURRENT_VERSION=$(grep "bundleVersion:" ProjectSettings/ProjectSettings.asset | sed 's/.*bundleVersion: //') - echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT - - name: Get last release commit - id: last_commit - run: | - LAST_RELEASE_DATE=$(git show -s --format=%cI "${{ steps.current_version.outputs.current }}") - echo "date=$LAST_RELEASE_DATE" >> $GITHUB_OUTPUT - - - name: Create release branch from base + - name: Display Configuration run: | - if git ls-remote --exit-code --heads origin "$BRANCH"; then - echo "Deleting remote branch $BRANCH" - git push origin --delete "$BRANCH" - fi - - echo "Creating release branch $BRANCH from main" - git checkout -b "$BRANCH" origin/main - - - name: Get merged PRs since last release - id: get_prs - uses: actions/github-script@v8 - with: - script: | - const lastReleaseDate = '${{ steps.last_commit.outputs.date }}'; + echo "============================================" + echo "๐ŸŽฎ Unity SDK Release Composition" + echo "๐Ÿงฉ Bump Command: $BUMP_COMMAND" + echo "๐Ÿท๏ธ Postfix: $POSTFIX" + echo "============================================" - // Get merged PRs - const { data: prs } = await github.rest.pulls.list({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'closed', - base: 'main', - per_page: 100 - }); - - // Filter and process PRs - const mergedPrs = prs - .filter(pr => pr.merged_at && new Date(pr.merged_at) > new Date(lastReleaseDate)) - .map(pr => ({ - number: pr.number, - title: pr.title, - })); - core.setOutput('prs', JSON.stringify(mergedPrs)); - - const hasFeatures = mergedPrs.some(pr => /^feat/i.test(pr.title)); - core.setOutput('isFeature', hasFeatures); - - - name: Calculate new version - id: new_version + - name: Prepare Environment run: | - CURRENT="${{ steps.current_version.outputs.current }}" - RELEASE_TYPE="${{ inputs.release-type }}" - IS_FEATURE='${{ steps.get_prs.outputs.isFeature }}' - - # Extract base version and determine current pre-release type - if [[ "$CURRENT" =~ -alpha\. ]]; then - BASE_VERSION="${CURRENT%-alpha.*}" - PRERELEASE_NUM="${CURRENT##*-alpha.}" - PRERELEASE_TYPE="alpha" - elif [[ "$CURRENT" =~ -beta\. ]]; then - BASE_VERSION="${CURRENT%-beta.*}" - PRERELEASE_NUM="${CURRENT##*-beta.}" - PRERELEASE_TYPE="beta" - else - BASE_VERSION="$CURRENT" - PRERELEASE_TYPE="stable" - fi + brew install gh jq || true + gh auth status || gh auth login --with-token <<< "$GH_TOKEN" - # Helper function to bump version - bump_version() { - local base=$1 - local is_feature=$2 - local major=${base:0:2} - local minor=${base:2:2} - local patch=${base:4:2} - - if [[ "$is_feature" == "true" ]]; then - minor=$(printf "%02d" $((10#$minor + 1))) - patch="00" - else - patch=$(printf "%02d" $((10#$patch + 1))) - fi - - echo "${major}${minor}${patch}" - } - - # Determine new version based on current and desired release types - if [[ "$RELEASE_TYPE" == "Alpha" ]]; then - if [[ "$PRERELEASE_TYPE" == "alpha" ]]; then - # Increment alpha number - NEW_VERSION="$BASE_VERSION-alpha.$((PRERELEASE_NUM + 1))" - else - # New alpha release from stable or beta - NEW_VERSION="$(bump_version "$BASE_VERSION" "$IS_FEATURE")-alpha.1" - fi - elif [[ "$RELEASE_TYPE" == "Beta" ]]; then - if [[ "$PRERELEASE_TYPE" == "beta" ]]; then - # Increment beta number - NEW_VERSION="$BASE_VERSION-beta.$((PRERELEASE_NUM + 1))" - elif [[ "$PRERELEASE_TYPE" == "alpha" ]]; then - # Promote alpha to beta - NEW_VERSION="$BASE_VERSION-beta.1" - else - # New beta release from stable - NEW_VERSION="$(bump_version "$BASE_VERSION" "$IS_FEATURE")-beta.1" - fi + - name: Run composeRelease.sh + run: | + chmod +x ./composeRelease.sh + if [[ -n "$POSTFIX" ]]; then + ./composeRelease.sh "$BUMP_COMMAND" "$POSTFIX" || echo "composeRelease.sh failed, continuing to patch manually" else - # Release type is Current (stable) - if [[ "$PRERELEASE_TYPE" != "stable" ]]; then - # Promote pre-release to stable - NEW_VERSION="$BASE_VERSION" - else - # Bump stable version - NEW_VERSION="$(bump_version "$CURRENT" "$IS_FEATURE")" - fi + ./composeRelease.sh "$BUMP_COMMAND" || echo "composeRelease.sh failed, continuing to patch manually" fi - echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - - name: Create release branch + - name: Detect New Version + id: version run: | - git checkout -b rel/${{ steps.new_version.outputs.version }} - git push -u origin rel/${{ steps.new_version.outputs.version }} + VERSION=$(cat OneSignalExample/Assets/OneSignal/VERSION) + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "โœ… Detected new version: $VERSION" - - name: Create temp branch - if: inputs.release-type == 'Alpha' || inputs.release-type == 'Beta' + - name: ๐Ÿ’พ Apply Version Changes and Commit run: | - git checkout -b release-${{ steps.new_version.outputs.version }} - git push -u origin release-${{ steps.new_version.outputs.version }} - - # Unity specific steps - - name: Run composeRelease.sh - run: | - chmod +x ./composeRelease.sh - ./composeRelease.sh $VERSION - shell: bash + set -e + VERSION=${{ env.VERSION }} + echo "๐Ÿ”ง Updating version references to $VERSION" - - name: Check native SDK version changes - id: native_deps - run: | - # Get the current plugin.xml - CURRENT_PLUGIN=$(cat plugin.xml) + git fetch origin "release/$VERSION" + git checkout "release/$VERSION" || git checkout -b "release/$VERSION" - # Extract current Android SDK version - ANDROID_VERSION=$(echo "$CURRENT_PLUGIN" | grep -oP 'com\.onesignal:OneSignal:\K[0-9.]+' | head -1) + # Extract current version for replacement + CURRENT=$(grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' OneSignalExample/Assets/OneSignal/VERSION | head -n 1) + echo "Detected previous version: $CURRENT" - # Extract current iOS SDK version - IOS_VERSION=$(echo "$CURRENT_PLUGIN" | grep -oP 'OneSignalXCFramework.*spec="\K[0-9.]+' | head -1) + # 1๏ธโƒฃ Update OneSignal.cs + sed -i '' "s/Version = \".*\";/Version = \"$VERSION\";/" com.onesignal.unity.core/Runtime/OneSignal.cs + + # 2๏ธโƒฃ Update OneSignalPlatform.cs header + OLD_HEADER=$(printf "%02d%02d%02d" $(echo $CURRENT | tr '.' ' ')) + NEW_HEADER=$(printf "%02d%02d%02d" $(echo $VERSION | tr '.' ' ')) + sed -i '' "s/VersionHeader = \".*\";/VersionHeader = \"$NEW_HEADER\";/" com.onesignal.unity.core/Runtime/OneSignalPlatform.cs - # Get previous plugin.xml from HEAD~1 (before the commit we just made) - PREVIOUS_PLUGIN=$(git show HEAD~1:plugin.xml) + # 3๏ธโƒฃ Update UIApplication+OneSignalUnity.mm iOS header + sed -i '' "s/setSdkVersion:@\".*\"];$/setSdkVersion:@\"$NEW_HEADER\"];/" com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm - # Extract previous Android SDK version - PREVIOUS_ANDROID=$(echo "$PREVIOUS_PLUGIN" | grep -oP 'com\.onesignal:OneSignal:\K[0-9.]+' | head -1) + # 4๏ธโƒฃ Update all package.json versions + find . -path "*/package.json" -exec sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" {} \; + find . -path "*/package.json" -exec sed -i '' "s/\"com.onesignal.unity.core\": \".*\"/\"com.onesignal.unity.core\": \"$VERSION\"/" {} \; - # Extract previous iOS SDK version - PREVIOUS_IOS=$(echo "$PREVIOUS_PLUGIN" | grep -oP 'OneSignalXCFramework.*spec="\K[0-9.]+' | head -1) + # 5๏ธโƒฃ Update packages-lock.json + sed -i '' "s/\"com.onesignal.unity.core\": \".*\"/\"com.onesignal.unity.core\": \"$VERSION\"/" OneSignalExample/Packages/packages-lock.json - # Build output for native dependency changes - NATIVE_UPDATES="" - if [[ "$ANDROID_VERSION" != "$PREVIOUS_ANDROID" && ! -z "$PREVIOUS_ANDROID" ]]; then - printf -v NATIVE_UPDATES '%sANDROID_UPDATE=true\nANDROID_FROM=%s\nANDROID_TO=%s\n' "$NATIVE_UPDATES" "$PREVIOUS_ANDROID" "$ANDROID_VERSION" - fi + # 6๏ธโƒฃ Update .asmdef version expressions + find OneSignalExample/Assets/OneSignal -name "*.asmdef" -exec sed -i '' "s/\"expression\": \".*\"/\"expression\": \"$VERSION\"/" {} \; - if [[ "$IOS_VERSION" != "$PREVIOUS_IOS" && ! -z "$PREVIOUS_IOS" ]]; then - printf -v NATIVE_UPDATES '%sIOS_UPDATE=true\nIOS_FROM=%s\nIOS_TO=%s\n' "$NATIVE_UPDATES" "$PREVIOUS_IOS" "$IOS_VERSION" + # 7๏ธโƒฃ Update CHANGELOG.md section + CHANGELOG="OneSignalExample/Assets/OneSignal/CHANGELOG.md" + if grep -q "\[Unreleased\]" "$CHANGELOG"; then + sed -i '' "s/## \[Unreleased\]/## [Unreleased]\n## [$VERSION]/" "$CHANGELOG" fi - # Output the variables - echo "$NATIVE_UPDATES" >> $GITHUB_OUTPUT - - - name: Generate release notes - id: release_notes - uses: actions/github-script@v8 - with: - script: | - // Trim whitespace from PR titles - const prs = JSON.parse('${{ steps.get_prs.outputs.prs }}').map(pr => ({ - ...pr, - title: pr.title.trim() - })); - - // Categorize PRs - const features = prs.filter(pr => /^feat/i.test(pr.title)); - const fixes = prs.filter(pr => /^fix/i.test(pr.title)); - const improvements = prs.filter(pr => /^(perf|refactor|chore)/i.test(pr.title)); - - // Helper function to build section - const buildSection = (title, prs) => { - if (prs.length === 0) return ''; - let section = `### ${title}\n\n`; - prs.forEach(pr => { - section += `- ${pr.title} (#${pr.number})\n`; - }); - return section + '\n'; - }; - - let releaseNotes = `Channels: ${{ inputs.release-type }}\n\n`; - releaseNotes += buildSection('๐Ÿš€ New Features', features); - releaseNotes += buildSection('๐Ÿ› Bug Fixes', fixes); - releaseNotes += buildSection('โœจ Improvements', improvements); - - // Check for native dependency changes - const hasAndroidUpdate = '${{ steps.native_deps.outputs.ANDROID_UPDATE }}' === 'true'; - const hasIosUpdate = '${{ steps.native_deps.outputs.IOS_UPDATE }}' === 'true'; + echo "โœ… Version updates applied." - if (hasAndroidUpdate || hasIosUpdate) { - releaseNotes += '\n### ๐Ÿ› ๏ธ Native Dependency Updates\n\n'; - if (hasAndroidUpdate) { - releaseNotes += `- Update Android SDK from ${{ steps.native_deps.outputs.ANDROID_FROM }} to ${{ steps.native_deps.outputs.ANDROID_TO }}\n`; - releaseNotes += `- See [release notes](https://github.com/OneSignal/OneSignal-Android-SDK/releases) for full details\n`; - } - if (hasIosUpdate) { - releaseNotes += `- Update iOS SDK from ${{ steps.native_deps.outputs.IOS_FROM }} to ${{ steps.native_deps.outputs.IOS_TO }}\n`; - releaseNotes += `- See [release notes](https://github.com/OneSignal/OneSignal-iOS-SDK/releases) for full details\n`; - } - releaseNotes += '\n'; - } + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - core.setOutput('notes', releaseNotes); + git add . + git commit -m "chore(release): update version files for $VERSION" || echo "No changes to commit" + git push origin "release/$VERSION" - - name: Create release PR + - name: ๐Ÿ” Confirm PR Exists run: | - NEW_VERSION="${{ steps.new_version.outputs.version }}" - - # Write release notes to file to avoid shell interpretation - cat > release_notes.md << 'EOF' - ${{ steps.release_notes.outputs.notes }} - EOF - - gh pr create \ - --title "Release $NEW_VERSION" \ - --body-file release_notes.md \ - --base main \ - --reviewer jkasten2 + PR_URL=$(gh pr list --head "release/$VERSION" --json url --jq '.[0].url') + if [[ -n "$PR_URL" ]]; then + echo "โœ… Release PR found: $PR_URL" + else + echo "โš ๏ธ No PR found. composeRelease.sh should have created one." + echo "If missing, create manually from release/$VERSION โ†’ main." + fi From 37e50641837e115494f378bab248c9d138f3e1cc Mon Sep 17 00:00:00 2001 From: jinliu9508 Date: Wed, 29 Oct 2025 01:46:33 -0400 Subject: [PATCH 4/4] Bumped version to 5.1.16 --- .../OneSignal.UnityPackage.Attribution.asmdef | 2 +- OneSignalExample/Assets/OneSignal/CHANGELOG.md | 4 +++- .../Editor/OneSignal.UnityPackage.Editor.asmdef | 2 +- .../OneSignal.UnityPackage.Example.asmdef | 2 +- OneSignalExample/Assets/OneSignal/VERSION | 2 +- OneSignalExample/Packages/packages-lock.json | 14 +++++++------- .../ProjectSettings/ProjectSettings.asset | 16 +++------------- com.onesignal.unity.android/package.json | 4 ++-- com.onesignal.unity.core/Runtime/OneSignal.cs | 2 +- .../Runtime/OneSignalPlatform.cs | 2 +- com.onesignal.unity.core/package.json | 2 +- .../Plugins/iOS/UIApplication+OneSignalUnity.mm | 2 +- com.onesignal.unity.ios/package.json | 4 ++-- 13 files changed, 25 insertions(+), 33 deletions(-) diff --git a/OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef b/OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef index a82956cd8..954c418d9 100644 --- a/OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef +++ b/OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef @@ -16,7 +16,7 @@ "versionDefines": [ { "name": "com.onesignal.unity.core", - "expression": "5.1.15", + "expression": "5.1.16", "define": "ONE_SIGNAL_INSTALLED" } ], diff --git a/OneSignalExample/Assets/OneSignal/CHANGELOG.md b/OneSignalExample/Assets/OneSignal/CHANGELOG.md index 2fd43a785..b3191b18a 100644 --- a/OneSignalExample/Assets/OneSignal/CHANGELOG.md +++ b/OneSignalExample/Assets/OneSignal/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [5.1.16] ## [5.1.15] ### Changed - Updated included Android SDK from 5.1.31 to [5.1.37](https://github.com/OneSignal/OneSignal-Android-SDK/releases/tag/5.1.37) @@ -483,7 +484,8 @@ If you run into any problems, please donโ€™t hesitate to [open an issue](https:/ - If you are updating from a previous version of the OneSignal Unity SDK please follow the Unity Asset Store instructions in the [README](https://github.com/OneSignal/OneSignal-Unity-SDK/README.md#unity-asset-store) to ensure a smooth transition. -[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/5.1.15...HEAD +[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/5.1.16...HEAD +[5.1.16]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/5.1.15...5.1.16 [5.1.15]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/5.1.14...5.1.15 [5.1.14]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/5.1.13...5.1.14 [5.1.13]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/5.1.12...5.1.13 diff --git a/OneSignalExample/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef b/OneSignalExample/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef index d90ee149f..e02effcb1 100644 --- a/OneSignalExample/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef +++ b/OneSignalExample/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef @@ -16,7 +16,7 @@ "versionDefines": [ { "name": "com.onesignal.unity.core", - "expression": "5.1.15", + "expression": "5.1.16", "define": "ONE_SIGNAL_INSTALLED" } ], diff --git a/OneSignalExample/Assets/OneSignal/Example/OneSignal.UnityPackage.Example.asmdef b/OneSignalExample/Assets/OneSignal/Example/OneSignal.UnityPackage.Example.asmdef index e99841511..ade4035fe 100644 --- a/OneSignalExample/Assets/OneSignal/Example/OneSignal.UnityPackage.Example.asmdef +++ b/OneSignalExample/Assets/OneSignal/Example/OneSignal.UnityPackage.Example.asmdef @@ -18,7 +18,7 @@ "versionDefines": [ { "name": "com.onesignal.unity.core", - "expression": "5.1.15", + "expression": "5.1.16", "define": "ONE_SIGNAL_INSTALLED" } ], diff --git a/OneSignalExample/Assets/OneSignal/VERSION b/OneSignalExample/Assets/OneSignal/VERSION index 40dc92612..16cf70e74 100755 --- a/OneSignalExample/Assets/OneSignal/VERSION +++ b/OneSignalExample/Assets/OneSignal/VERSION @@ -1 +1 @@ -5.1.15 \ No newline at end of file +5.1.16 \ No newline at end of file diff --git a/OneSignalExample/Packages/packages-lock.json b/OneSignalExample/Packages/packages-lock.json index ff60483fa..e347c0672 100644 --- a/OneSignalExample/Packages/packages-lock.json +++ b/OneSignalExample/Packages/packages-lock.json @@ -5,7 +5,7 @@ "depth": 0, "source": "local", "dependencies": { - "com.onesignal.unity.core": "5.1.15" + "com.onesignal.unity.core": "5.1.16" } }, "com.onesignal.unity.core": { @@ -19,11 +19,11 @@ "depth": 0, "source": "local", "dependencies": { - "com.onesignal.unity.core": "5.1.15" + "com.onesignal.unity.core": "5.1.16" } }, "com.unity.ai.navigation": { - "version": "1.1.5", + "version": "1.1.4", "depth": 0, "source": "registry", "dependencies": { @@ -45,7 +45,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "3.0.35", + "version": "3.0.24", "depth": 0, "source": "registry", "dependencies": { @@ -54,7 +54,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.22", + "version": "2.0.18", "depth": 0, "source": "registry", "dependencies": { @@ -97,7 +97,7 @@ "url": "https://packages.unity.com" }, "com.unity.textmeshpro": { - "version": "3.0.7", + "version": "3.0.6", "depth": 0, "source": "registry", "dependencies": { @@ -106,7 +106,7 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.7.7", + "version": "1.7.5", "depth": 0, "source": "registry", "dependencies": { diff --git a/OneSignalExample/ProjectSettings/ProjectSettings.asset b/OneSignalExample/ProjectSettings/ProjectSettings.asset index b79c27ffe..c012614dd 100644 --- a/OneSignalExample/ProjectSettings/ProjectSettings.asset +++ b/OneSignalExample/ProjectSettings/ProjectSettings.asset @@ -48,7 +48,6 @@ PlayerSettings: defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 - unsupportedMSAAFallback: 0 m_SpriteBatchVertexThreshold: 300 m_MTRendering: 1 mipStripping: 0 @@ -76,8 +75,6 @@ PlayerSettings: androidMinimumWindowWidth: 400 androidMinimumWindowHeight: 300 androidFullscreenMode: 1 - androidAutoRotationBehavior: 1 - androidPredictiveBackSupport: 0 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -85,7 +82,6 @@ PlayerSettings: muteOtherAudioSources: 0 Prepare IOS For Recording: 0 Force IOS Speakers When Recording: 0 - audioSpatialExperience: 0 deferSystemGesturesMode: 0 hideHomeButton: 0 submitAnalytics: 1 @@ -139,9 +135,7 @@ PlayerSettings: vulkanEnableLateAcquireNextImage: 0 vulkanEnableCommandBufferRecycling: 1 loadStoreDebugModeEnabled: 0 - visionOSBundleVersion: 1.0 - tvOSBundleVersion: 1.0 - bundleVersion: 5.1.15 + bundleVersion: 5.1.16 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 @@ -153,7 +147,6 @@ PlayerSettings: isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 enableOpenGLProfilerGPURecorders: 1 - allowHDRDisplaySupport: 0 useHDRDisplay: 0 hdrBitDepth: 0 m_ColorGamuts: 00000000 @@ -188,10 +181,8 @@ PlayerSettings: strictShaderVariantMatching: 0 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSSimulatorArchitecture: 0 iOSTargetOSVersionString: 12.0 tvOSSdkVersion: 0 - tvOSSimulatorArchitecture: 0 tvOSRequireExtendedGameController: 0 tvOSTargetOSVersionString: 12.0 VisionOSSdkVersion: 0 @@ -238,7 +229,6 @@ PlayerSettings: iOSMetalForceHardShadows: 0 metalEditorSupport: 1 metalAPIValidation: 1 - metalCompileShaderBinary: 0 iOSRenderExtraFrameOnPause: 0 iosCopyPluginsCodeInsteadOfSymlink: 0 appleDeveloperTeamID: @@ -523,6 +513,7 @@ PlayerSettings: switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchEnableFileSystemTrace: 0 + switchUseGOLDLinker: 0 switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: @@ -652,7 +643,7 @@ PlayerSettings: switchSocketBufferEfficiency: 4 switchSocketInitializeEnabled: 1 switchNetworkInterfaceManagerInitializeEnabled: 1 - switchDisableHTCSPlayerConnection: 0 + switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 switchUseLegacyFmodPriorities: 0 switchUseMicroSleepForYield: 1 @@ -823,7 +814,6 @@ PlayerSettings: metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} metroSplashScreenUseBackgroundColor: 0 - syncCapabilities: 0 platformCapabilities: {} metroTargetDeviceFamilies: {} metroFTAName: diff --git a/com.onesignal.unity.android/package.json b/com.onesignal.unity.android/package.json index e92df9e18..b2ae43f2d 100644 --- a/com.onesignal.unity.android/package.json +++ b/com.onesignal.unity.android/package.json @@ -1,11 +1,11 @@ { "name": "com.onesignal.unity.android", "displayName": "OneSignal Unity SDK - Android", - "version": "5.1.15", + "version": "5.1.16", "unity": "2018.4", "description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.", "dependencies": { - "com.onesignal.unity.core": "5.1.15" + "com.onesignal.unity.core": "5.1.16" }, "keywords": [ "push-notifications", diff --git a/com.onesignal.unity.core/Runtime/OneSignal.cs b/com.onesignal.unity.core/Runtime/OneSignal.cs index 60e43c492..a2a35cbe7 100755 --- a/com.onesignal.unity.core/Runtime/OneSignal.cs +++ b/com.onesignal.unity.core/Runtime/OneSignal.cs @@ -42,7 +42,7 @@ namespace OneSignalSDK /// public static partial class OneSignal { - public const string Version = "5.1.15"; + public const string Version = "5.1.16"; /// /// The default static instance of the OneSignal Unity SDK diff --git a/com.onesignal.unity.core/Runtime/OneSignalPlatform.cs b/com.onesignal.unity.core/Runtime/OneSignalPlatform.cs index 34d1420f8..fbb21f472 100644 --- a/com.onesignal.unity.core/Runtime/OneSignalPlatform.cs +++ b/com.onesignal.unity.core/Runtime/OneSignalPlatform.cs @@ -40,7 +40,7 @@ namespace OneSignalSDK { public abstract class OneSignalPlatform { - public const string VersionHeader = "050115"; + public const string VersionHeader = "050116"; internal static event Action OnInitialize; diff --git a/com.onesignal.unity.core/package.json b/com.onesignal.unity.core/package.json index 5411e1d92..5f3438609 100644 --- a/com.onesignal.unity.core/package.json +++ b/com.onesignal.unity.core/package.json @@ -1,7 +1,7 @@ { "name": "com.onesignal.unity.core", "displayName": "OneSignal Unity SDK - Core", - "version": "5.1.15", + "version": "5.1.16", "unity": "2018.4", "description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.", "dependencies": { diff --git a/com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm b/com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm index 651acf37b..84337fca6 100644 --- a/com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm +++ b/com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm @@ -97,7 +97,7 @@ - (void)setOneSignalUnityDelegate:(id )delegate { - (BOOL)oneSignalApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [OneSignalWrapper setSdkType:@"unity"]; - [OneSignalWrapper setSdkVersion:@"050115"]; + [OneSignalWrapper setSdkVersion:@"050116"]; [OneSignal initialize:nil withLaunchOptions:launchOptions]; if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)]) diff --git a/com.onesignal.unity.ios/package.json b/com.onesignal.unity.ios/package.json index b1b1c8a24..a1b08c49b 100644 --- a/com.onesignal.unity.ios/package.json +++ b/com.onesignal.unity.ios/package.json @@ -1,11 +1,11 @@ { "name": "com.onesignal.unity.ios", "displayName": "OneSignal Unity SDK - iOS", - "version": "5.1.15", + "version": "5.1.16", "unity": "2018.4", "description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.", "dependencies": { - "com.onesignal.unity.core": "5.1.15" + "com.onesignal.unity.core": "5.1.16" }, "keywords": [ "push-notifications",