Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 38 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Filename (cd.yml) should match the workflow filename in Trusted Publisher setting on npmjs
name: Publish to NPM & Github
on:
workflow_dispatch:
pull_request:
types:
- closed
Expand All @@ -15,8 +16,9 @@ permissions:
jobs:
publish:
if: |
github.event.pull_request.merged == true &&
contains(github.event.pull_request.title, 'chore: Release')
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
contains(github.event.pull_request.title, 'chore: Release'))
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -27,19 +29,45 @@ jobs:
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
cache: ""

- name: Determine npm tag
id: npm-tag
run: |
VERSION=$(node -p "require('./com.onesignal.unity.core/package.json').version")
if [[ "$VERSION" == *"alpha"* ]]; then
echo "tag=--tag alpha" >> $GITHUB_OUTPUT
elif [[ "$VERSION" == *"beta"* ]]; then
echo "tag=--tag beta" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
TAG=""
if echo "$VERSION" | grep -qi "alpha"; then
TAG="alpha"
elif echo "$VERSION" | grep -qi "beta"; then
TAG="beta"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Using tag: [$TAG]"

- run: npm publish com.onesignal.unity.core --access public --provenance ${{ steps.npm-tag.outputs.tag }}

- run: npm publish com.onesignal.unity.android --access public --provenance ${{ steps.npm-tag.outputs.tag }}
- name: Debug tag output
run: |
echo "Tag from output: [${{ steps.npm-tag.outputs.tag }}]"

- run: npm publish com.onesignal.unity.ios --access public --provenance ${{ steps.npm-tag.outputs.tag }}
- name: Publish packages
run: |
publish_pkg() {
local pkg=$1
cd "$pkg"
VERSION=$(node -p "require('./package.json').version")
echo "Publishing $pkg@$VERSION"
if npm view "$pkg@$VERSION" version 2>/dev/null; then
echo "Version $VERSION already published, skipping"
else
TAG="${{ steps.npm-tag.outputs.tag }}"
if [ -n "$TAG" ]; then
npm publish --access public --provenance --tag "$TAG"
else
npm publish --access public --provenance
fi
fi
cd ..
}
publish_pkg com.onesignal.unity.core
publish_pkg com.onesignal.unity.android
publish_pkg com.onesignal.unity.ios
4 changes: 4 additions & 0 deletions OneSignalExample/Assets/OneSignal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed


## [5.1.16]
### Changed


## [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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<dependencies>
<iosPods>
<iosPod name="OneSignalXCFramework" version="5.2.16" addToAllTargets="true" />
<iosPod name="OneSignalXCFramework" version="5.4.0" addToAllTargets="true" />
</iosPods>
</dependencies>