Skip to content

Commit 64defcf

Browse files
committed
include release note to CHANGELOG
1 parent 4dd7698 commit 64defcf

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

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

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ jobs:
6868
with:
6969
ref: ${{ needs.prep.outputs.release_branch }}
7070

71-
- name: Configure Git
72-
run: |
73-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
74-
git config --global user.name "github-actions[bot]"
75-
7671
- name: Get current native SDK versions
7772
id: current_versions
7873
run: |
@@ -117,6 +112,9 @@ jobs:
117112
sed -i "s/\"com.onesignal.unity.core\": \"[0-9.]\+\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/g" OneSignalExample/Packages/packages-lock.json
118113
sed -i "s/bundleVersion: .*/bundleVersion: ${{ inputs.unity_version }}/" OneSignalExample/ProjectSettings/ProjectSettings.asset
119114
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm
115+
116+
git config user.name "github-actions[bot]"
117+
git config user.email "github-actions[bot]@users.noreply.github.com"
120118
git add . && git commit -m "Release ${{ inputs.unity_version }}" && git push
121119
122120
create-pr:
@@ -128,4 +126,33 @@ jobs:
128126
android_from: ${{ needs.update-version.outputs.android_from }}
129127
android_to: ${{ inputs.android_version }}
130128
ios_from: ${{ needs.update-version.outputs.ios_from }}
131-
ios_to: ${{ inputs.ios_version }}
129+
ios_to: ${{ inputs.ios_version }}
130+
131+
update-changelog:
132+
needs: [prep, create-pr]
133+
runs-on: ubuntu-latest
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v5
137+
with:
138+
ref: ${{ needs.prep.outputs.release_branch }}
139+
140+
- name: Get PR release notes
141+
id: notes
142+
run: |
143+
sudo apt-get update && sudo apt-get install -y gh || true
144+
PR_NUMBER=$(gh pr list --head "${{ needs.prep.outputs.release_branch }}" --json number -q '.[0].number' || echo "")
145+
if [ -z "$PR_NUMBER" ]; then echo "RELEASE_NOTES=" >> $GITHUB_ENV; exit 0; fi
146+
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')
147+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
148+
echo "$cleaned_notes" >> $GITHUB_ENV
149+
echo "EOF" >> $GITHUB_ENV
150+
151+
- name: Update CHANGELOG.md
152+
run: |
153+
awk -v ver="${{ inputs.unity_version }}" -v notes="$RELEASE_NOTES" \
154+
'/^## \[Unreleased\]/ { print $0; print "## [" ver "]\n### Changed"; print notes "\n"; next } { print $0 }' \
155+
OneSignalExample/Assets/OneSignal/CHANGELOG.md > /tmp/changelog.tmp && mv /tmp/changelog.tmp OneSignalExample/Assets/OneSignal/CHANGELOG.md
156+
git config user.name "github-actions[bot]"
157+
git config user.email "github-actions[bot]@users.noreply.github.com"
158+
git add . && git commit -m "Update CHANGELOG.md for ${{ inputs.unity_version }}" && git push

0 commit comments

Comments
 (0)