@@ -234,23 +234,44 @@ jobs:
234234 project-path : OneSignalExample
235235 args : -quit -batchmode -nographics -buildTarget Android -executeMethod OneSignalSDK.OneSignalPackagePublisher.ExportUnityPackage
236236
237+ # get the release notes from the PR generated by the shared action
238+ - name : Get PR release notes
239+ id : notes
240+ env :
241+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
242+ run : |
243+ release_notes=$(gh pr view "${{ github.event.pull_request.number }}" --json body -q '.body')
244+
245+ cleaned_notes=$(echo "$release_notes" \
246+ | awk '/^Update/{found=1} found' \
247+ | sed '/^- - -$/d' \
248+ | sed '/^[[:space:]]*$/d')
249+
250+ echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
251+ echo "$cleaned_notes" >> $GITHUB_ENV
252+ echo "EOF" >> $GITHUB_ENV
253+
254+ - name : Update CHANGELOG.md
255+ run : |
256+ echo "Inserting release notes for ${{ inputs.unity_version }}..."
257+ awk -v ver="${{ inputs.unity_version }}" \
258+ -v notes="$RELEASE_NOTES" \
259+ 'BEGIN { printed=0 }
260+ /^## \[Unreleased\]/ {
261+ print $0;
262+ print "## [" ver "]\n### Changed";
263+ print notes "\n";
264+ printed=1;
265+ next
266+ }
267+ { print $0 }' CHANGELOG.md > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG.md
268+
237269 - name : Commit Release
238270 run : |
239271 git add .
240272 git commit -m "Release ${{ inputs.unity_version }}"
241273 git push
242274
243- - name : Debug — list Unity package files
244- run : |
245- echo "Current working directory:"
246- pwd
247- echo ""
248- echo "List of all files under OneSignalExample:"
249- ls -Rlh OneSignalExample || true
250- echo ""
251- echo "Searching for .unitypackage files:"
252- find OneSignalExample -type f -name "*.unitypackage" -print
253-
254275 - name : Draft Release
255276 env :
256277 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments