Skip to content

Commit 1435855

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

File tree

2 files changed

+30
-151
lines changed

2 files changed

+30
-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: 30 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -58,80 +58,44 @@ 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+
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; }
9881
sed -i -E "s/spec=\"com\.onesignal:OneSignal:[0-9][0-9.]*\"/spec=\"com.onesignal:OneSignal:$VERSION\"/" com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml
9982
sed -i -E "s/'com\.onesignal:OneSignal:[0-9][0-9.]*'/'com.onesignal:OneSignal:$VERSION'/" OneSignalExample/Assets/Plugins/Android/mainTemplate.gradle
10083
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
84+
git add . && git commit -m "Bump Android SDK $VERSION" && git push
10685
10786
- name: Update iOS SDK version
10887
if: inputs.ios_version != ''
10988
run: |
11089
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-
90+
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; }
12191
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
92+
git add . && git commit -m "Bump iOS SDK $VERSION" && git push
12793
12894
create-pr:
12995
needs: [prep, update-version]
13096
uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main
13197
with:
13298
release_branch: ${{ needs.prep.outputs.release_branch }}
133-
version_from: ${{ needs.update-version.outputs.unity_from }}
134-
version_to: ${{ inputs.unity_version }}
13599
android_from: ${{ needs.update-version.outputs.android_from }}
136100
android_to: ${{ inputs.android_version }}
137101
ios_from: ${{ needs.update-version.outputs.ios_from }}
@@ -146,77 +110,48 @@ jobs:
146110
with:
147111
ref: ${{ needs.prep.outputs.release_branch }}
148112

149-
- name: Setup Environment
150-
uses: ./.github/actions/setup-environment
113+
- name: Configure Git
114+
run: |
115+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
116+
git config --global user.name "github-actions[bot]"
151117
152118
- name: Update Unity SDK version
153119
run: |
154-
echo "Updating Unity SDK version to ${{ inputs.unity_version }}"
155-
156-
# Version string formats
157120
PADDED_VERSION=$(printf "%06d" $(echo "${{ inputs.unity_version }}" | sed 's/[^0-9]//g'))
158-
159-
# VERSION file
160121
printf "%s" "${{ inputs.unity_version }}" > OneSignalExample/Assets/OneSignal/VERSION
161-
162-
# package.json files
163122
for file in com.onesignal.unity.core/package.json com.onesignal.unity.android/package.json com.onesignal.unity.ios/package.json; do
164123
sed -i "s/\"version\": \".*\"/\"version\": \"${{ inputs.unity_version }}\"/" "$file"
165124
sed -i "s/\"com.onesignal.unity.core\": \".*\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/" "$file"
166125
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
126+
sed -i "s/public const string Version = \".*\"/public const string Version = \"${{ inputs.unity_version }}\"/" com.onesignal.unity.core/Runtime/OneSignal.cs
127+
sed -i "s/public const string VersionHeader = \".*\"/public const string VersionHeader = \"${PADDED_VERSION}\"/" com.onesignal.unity.core/Runtime/OneSignalPlatform.cs
128+
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
178129
sed -i "s/\"expression\": \".*\"/\"expression\": \"${{ inputs.unity_version }}\"/" "$asm"
179130
done
131+
sed -i "s/\"com.onesignal.unity.core\": \"[0-9.]\+\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/g" OneSignalExample/Packages/packages-lock.json
132+
sed -i "s/bundleVersion: .*/bundleVersion: ${{ inputs.unity_version }}/" OneSignalExample/ProjectSettings/ProjectSettings.asset
133+
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm
180134
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
194135
- name: Cache Unity
195136
uses: actions/cache@v4
196137
with:
197138
path: /home/runner/Unity/Hub
198139
key: UnityEditor-${{ runner.os }}
199-
restore-keys: |
200-
UnityEditor-${{ runner.os }}
140+
restore-keys: UnityEditor-${{ runner.os }}
201141

202-
# setup Unity using the version file
203142
- name: Setup Unity
204143
uses: buildalon/unity-setup@v2.1.1
205144
with:
206145
version-file: 'OneSignalExample/ProjectSettings/ProjectVersion.txt'
207146

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

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
153+
- name: Clean Unity locks
154+
run: pkill -f Unity || true; rm -rf OneSignalExample/{Temp,Library,obj,UserSettings} OneSignalExample/Temp/UnityLockfile 2>/dev/null || true
220155

221156
- name: Run UpdateProjectVersion
222157
uses: buildalon/unity-action@v3
@@ -230,63 +165,28 @@ jobs:
230165
project-path: OneSignalExample
231166
args: -quit -batchmode -nographics -buildTarget Android -executeMethod OneSignalSDK.OneSignalPackagePublisher.ExportUnityPackage
232167

233-
# get the release notes from the PR generated by the shared action
234168
- name: Get PR release notes
235169
id: notes
236170
env:
237171
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
238172
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-
173+
sudo apt-get update && sudo apt-get install -y gh || true
174+
gh auth login --with-token <<< "$GH_TOKEN"
175+
PR_NUMBER=$(gh pr list --head "${{ needs.prep.outputs.release_branch }}" --json number -q '.[0].number' || echo "")
176+
if [ -z "$PR_NUMBER" ]; then echo "RELEASE_NOTES=" >> $GITHUB_ENV; exit 0; fi
177+
cleaned_notes=$(gh pr view "$PR_NUMBER" --json body -q '.body' | awk '/^- Update/{found=1} found; /^<!-- Reviewable:start -->/{found=0} found' | sed '/^- - -$/d' | sed '/^[[:space:]]*$/d')
263178
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
264179
echo "$cleaned_notes" >> $GITHUB_ENV
265180
echo "EOF" >> $GITHUB_ENV
266181
267182
- name: Update CHANGELOG.md
268183
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"
184+
awk -v ver="${{ inputs.unity_version }}" -v notes="$RELEASE_NOTES" \
185+
'/^## \[Unreleased\]/ { print $0; print "## [" ver "]\n### Changed"; print notes "\n"; next } { print $0 }' \
186+
OneSignalExample/Assets/OneSignal/CHANGELOG.md > /tmp/changelog.tmp && mv /tmp/changelog.tmp OneSignalExample/Assets/OneSignal/CHANGELOG.md
284187
285188
- name: Commit Release
286-
run: |
287-
git add .
288-
git commit -m "Release ${{ inputs.unity_version }}"
289-
git push
189+
run: git add . && git commit -m "Release ${{ inputs.unity_version }}" && git push
290190

291191
- name: Draft Release
292192
env:

0 commit comments

Comments
 (0)