Skip to content

Commit 0e33df0

Browse files
committed
followup: remove action.yml
1 parent 6461025 commit 0e33df0

File tree

2 files changed

+31
-151
lines changed

2 files changed

+31
-151
lines changed

.github/actions/setup-environment/action.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/create-release-pr.yml

Lines changed: 31 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -58,80 +58,46 @@ jobs:
5858
with:
5959
ref: ${{ needs.prep.outputs.release_branch }}
6060

61-
- name: Setup Environment
62-
uses: ./.github/actions/setup-environment
61+
- name: Configure Git
62+
run: |
63+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
64+
git config --global user.name "github-actions[bot]"
6365
6466
- name: Get current native SDK versions
6567
id: current_versions
6668
run: |
67-
# Current Unity version
6869
CURRENT_VERSION=$(cat OneSignalExample/Assets/OneSignal/VERSION | tr -d '\n\r' | xargs)
69-
70-
# Extract current Android SDK version
7170
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)
72-
73-
# Extract current iOS SDK version
7471
IOS_VERSION=$(grep -oE 'version="[0-9.]+"' com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml | grep -oE '[0-9.]+' | head -1)
75-
7672
echo "unity_from=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
7773
echo "android_from=${ANDROID_VERSION}" >> $GITHUB_OUTPUT
7874
echo "ios_from=${IOS_VERSION}" >> $GITHUB_OUTPUT
79-
80-
echo " unity_from: ${CURRENT_VERSION}"
81-
echo " android_from: ${ANDROID_VERSION}"
82-
echo " ios_from: ${IOS_VERSION}"
8375
8476
- name: Update Android SDK version
8577
if: inputs.android_version != ''
8678
run: |
8779
VERSION="${{ inputs.android_version }}"
88-
89-
# Validate version exists on GitHub
90-
RELEASE=$(curl -s -H "Authorization: token ${{ github.token }}" \
91-
"https://api.github.com/repos/OneSignal/OneSignal-Android-SDK/releases/tags/${VERSION}")
92-
93-
if [ -z "$RELEASE" ]; then
94-
echo "✗ Android SDK version ${VERSION} not found"
95-
exit 1
96-
fi
97-
80+
# validate the version exists on GitHub
81+
curl -sfH "Authorization: token ${{ github.token }}" "https://api.github.com/repos/OneSignal/OneSignal-Android-SDK/releases/tags/${VERSION}" >/dev/null || { echo "✗ Android SDK version ${VERSION} not found"; exit 1; }
9882
sed -i -E "s/spec=\"com\.onesignal:OneSignal:[0-9][0-9.]*\"/spec=\"com.onesignal:OneSignal:$VERSION\"/" com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml
9983
sed -i -E "s/'com\.onesignal:OneSignal:[0-9][0-9.]*'/'com.onesignal:OneSignal:$VERSION'/" OneSignalExample/Assets/Plugins/Android/mainTemplate.gradle
10084
sed -i -E "s/<package>com\.onesignal:OneSignal:[0-9][0-9.]*<\/package>/<package>com.onesignal:OneSignal:$VERSION<\/package>/" OneSignalExample/ProjectSettings/AndroidResolverDependencies.xml
101-
102-
echo "✓ Updated Android SDK to ${VERSION}"
103-
git add .
104-
git commit -m "Bump Android SDK $VERSION"
105-
git push
85+
git add . && git commit -m "Bump Android SDK $VERSION" && git push
10686
10787
- name: Update iOS SDK version
10888
if: inputs.ios_version != ''
10989
run: |
11090
VERSION="${{ inputs.ios_version }}"
111-
112-
# Validate version exists on GitHub
113-
RELEASE=$(curl -s -H "Authorization: token ${{ github.token }}" \
114-
"https://api.github.com/repos/OneSignal/OneSignal-iOS-SDK/releases/tags/${VERSION}")
115-
116-
if [ -z "$RELEASE" ]; then
117-
echo "✗ iOS SDK version ${VERSION} not found"
118-
exit 1
119-
fi
120-
91+
# validate the version exists on GitHub
92+
curl -sfH "Authorization: token ${{ github.token }}" "https://api.github.com/repos/OneSignal/OneSignal-iOS-SDK/releases/tags/${VERSION}" >/dev/null || { echo "✗ iOS SDK version ${VERSION} not found"; exit 1; }
12193
sed -i -E "s/version=\"[0-9][0-9.]*\"/version=\"$VERSION\"/" com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml
122-
123-
echo "✓ Updated iOS SDK to ${VERSION}"
124-
git add .
125-
git commit -m "Bump iOS SDK $VERSION"
126-
git push
94+
git add . && git commit -m "Bump iOS SDK $VERSION" && git push
12795
12896
create-pr:
12997
needs: [prep, update-version]
13098
uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main
13199
with:
132100
release_branch: ${{ needs.prep.outputs.release_branch }}
133-
version_from: ${{ needs.update-version.outputs.unity_from }}
134-
version_to: ${{ inputs.unity_version }}
135101
android_from: ${{ needs.update-version.outputs.android_from }}
136102
android_to: ${{ inputs.android_version }}
137103
ios_from: ${{ needs.update-version.outputs.ios_from }}
@@ -146,77 +112,48 @@ jobs:
146112
with:
147113
ref: ${{ needs.prep.outputs.release_branch }}
148114

149-
- name: Setup Environment
150-
uses: ./.github/actions/setup-environment
115+
- name: Configure Git
116+
run: |
117+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
118+
git config --global user.name "github-actions[bot]"
151119
152120
- name: Update Unity SDK version
153121
run: |
154-
echo "Updating Unity SDK version to ${{ inputs.unity_version }}"
155-
156-
# Version string formats
157122
PADDED_VERSION=$(printf "%06d" $(echo "${{ inputs.unity_version }}" | sed 's/[^0-9]//g'))
158-
159-
# VERSION file
160123
printf "%s" "${{ inputs.unity_version }}" > OneSignalExample/Assets/OneSignal/VERSION
161-
162-
# package.json files
163124
for file in com.onesignal.unity.core/package.json com.onesignal.unity.android/package.json com.onesignal.unity.ios/package.json; do
164125
sed -i "s/\"version\": \".*\"/\"version\": \"${{ inputs.unity_version }}\"/" "$file"
165126
sed -i "s/\"com.onesignal.unity.core\": \".*\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/" "$file"
166127
done
167-
168-
sed -i "s/public const string Version = \".*\"/public const string Version = \"${{ inputs.unity_version }}\"/" \
169-
com.onesignal.unity.core/Runtime/OneSignal.cs
170-
sed -i "s/public const string VersionHeader = \".*\"/public const string VersionHeader = \"${PADDED_VERSION}\"/" \
171-
com.onesignal.unity.core/Runtime/OneSignalPlatform.cs
172-
173-
# asmdef files
174-
for asm in \
175-
OneSignalExample/Assets/OneSignal/Example/OneSignal.UnityPackage.Example.asmdef \
176-
OneSignalExample/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef \
177-
OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef; do
128+
sed -i "s/public const string Version = \".*\"/public const string Version = \"${{ inputs.unity_version }}\"/" com.onesignal.unity.core/Runtime/OneSignal.cs
129+
sed -i "s/public const string VersionHeader = \".*\"/public const string VersionHeader = \"${PADDED_VERSION}\"/" com.onesignal.unity.core/Runtime/OneSignalPlatform.cs
130+
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
178131
sed -i "s/\"expression\": \".*\"/\"expression\": \"${{ inputs.unity_version }}\"/" "$asm"
179132
done
133+
sed -i "s/\"com.onesignal.unity.core\": \"[0-9.]\+\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/g" OneSignalExample/Packages/packages-lock.json
134+
sed -i "s/bundleVersion: .*/bundleVersion: ${{ inputs.unity_version }}/" OneSignalExample/ProjectSettings/ProjectSettings.asset
135+
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm
180136
181-
# packages-lock.json
182-
sed -i "s/\"com.onesignal.unity.core\": \"[0-9.]\+\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/g" \
183-
OneSignalExample/Packages/packages-lock.json
184-
185-
# ProjectSettings.asset
186-
sed -i "s/bundleVersion: .*/bundleVersion: ${{ inputs.unity_version }}/" \
187-
OneSignalExample/ProjectSettings/ProjectSettings.asset
188-
189-
# iOS plugin version (UIApplication+OneSignalUnity.mm)
190-
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" \
191-
com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm
192-
193-
# to save time, use cached Unity installation if available
194137
- name: Cache Unity
195138
uses: actions/cache@v4
196139
with:
197140
path: /home/runner/Unity/Hub
198141
key: UnityEditor-${{ runner.os }}
199-
restore-keys: |
200-
UnityEditor-${{ runner.os }}
142+
restore-keys: UnityEditor-${{ runner.os }}
201143

202-
# setup Unity using the version file
203144
- name: Setup Unity
204145
uses: buildalon/unity-setup@v2.1.1
205146
with:
206147
version-file: 'OneSignalExample/ProjectSettings/ProjectVersion.txt'
207148

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

215-
- name: Cleaning up Unity locks
216-
run: |
217-
pkill -f Unity || true
218-
rm -f OneSignalExample/Temp/UnityLockfile
219-
rm -rf OneSignalExample/Library OneSignalExample/Temp OneSignalExample/obj OneSignalExample/UserSettings || true
155+
- name: Clean Unity locks
156+
run: pkill -f Unity || true; rm -rf OneSignalExample/{Temp,Library,obj,UserSettings} OneSignalExample/Temp/UnityLockfile 2>/dev/null || true
220157

221158
- name: Run UpdateProjectVersion
222159
uses: buildalon/unity-action@v3
@@ -230,63 +167,27 @@ jobs:
230167
project-path: OneSignalExample
231168
args: -quit -batchmode -nographics -buildTarget Android -executeMethod OneSignalSDK.OneSignalPackagePublisher.ExportUnityPackage
232169

233-
# get the release notes from the PR generated by the shared action
234170
- name: Get PR release notes
235171
id: notes
236172
env:
237173
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
238174
run: |
239-
# Find the PR with the release branch as head
240-
RELEASE_BRANCH="${{ needs.prep.outputs.release_branch }}"
241-
echo "Looking for PR with head branch: $RELEASE_BRANCH"
242-
243-
# Get PR number from the branch
244-
PR_NUMBER=$(gh pr list --head "$RELEASE_BRANCH" --json number -q '.[0].number' || echo "")
245-
246-
if [ -z "$PR_NUMBER" ]; then
247-
echo "⚠️ No PR found for branch $RELEASE_BRANCH"
248-
echo "RELEASE_NOTES=" >> $GITHUB_ENV
249-
exit 0
250-
fi
251-
252-
echo "Found PR #$PR_NUMBER"
253-
release_notes=$(gh pr view "$PR_NUMBER" --json body -q '.body')
254-
255-
echo "Raw RELEASE_NOTES contents:"
256-
echo "$release_notes"
257-
258-
cleaned_notes=$(echo "$release_notes" \
259-
| awk '/^- Update/{found=1} found' \
260-
| sed '/^- - -$/d' \
261-
| sed '/^[[:space:]]*$/d')
262-
175+
sudo apt-get update && sudo apt-get install -y gh || true
176+
PR_NUMBER=$(gh pr list --head "${{ needs.prep.outputs.release_branch }}" --json number -q '.[0].number' || echo "")
177+
if [ -z "$PR_NUMBER" ]; then echo "RELEASE_NOTES=" >> $GITHUB_ENV; exit 0; fi
178+
cleaned_notes=$(gh pr view "$PR_NUMBER" --json body -q '.body' | awk 'BEGIN{found=0} /^- Update/{found=1} /^<!-- Reviewable:start -->/{found=0;next} found' | sed '/^- - -$/d' | sed '/^[[:space:]]*$/d')
263179
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
264180
echo "$cleaned_notes" >> $GITHUB_ENV
265181
echo "EOF" >> $GITHUB_ENV
266182
267183
- name: Update CHANGELOG.md
268184
run: |
269-
echo "Inserting release notes for ${{ inputs.unity_version }}..."
270-
changelog_path="OneSignalExample/Assets/OneSignal/CHANGELOG.md"
271-
272-
# Inject release notes under the Unreleased section
273-
awk -v ver="${{ inputs.unity_version }}" \
274-
-v notes="$RELEASE_NOTES" \
275-
'BEGIN { printed=0 }
276-
/^## \[Unreleased\]/ {
277-
print $0;
278-
print "## [" ver "]\n### Changed";
279-
print notes "\n";
280-
printed=1;
281-
next
282-
}
283-
{ print $0 }' "$changelog_path" > "${changelog_path}.tmp" && mv "${changelog_path}.tmp" "$changelog_path"
185+
awk -v ver="${{ inputs.unity_version }}" -v notes="$RELEASE_NOTES" \
186+
'/^## \[Unreleased\]/ { print $0; print "## [" ver "]\n### Changed"; print notes "\n"; next } { print $0 }' \
187+
OneSignalExample/Assets/OneSignal/CHANGELOG.md > /tmp/changelog.tmp && mv /tmp/changelog.tmp OneSignalExample/Assets/OneSignal/CHANGELOG.md
284188
285189
- name: Commit Release
286-
run: |
287-
git add .
288-
git commit -m "Release ${{ inputs.unity_version }}"
289-
git push
190+
run: git add . && git commit -m "Release ${{ inputs.unity_version }}" && git push
290191

291192
- name: Draft Release
292193
env:

0 commit comments

Comments
 (0)