1010 build :
1111 name : Create Release
1212 runs-on : ubuntu-22.04
13+ outputs :
14+ release_url : ${{ steps.create_release.outputs.html_url }}
1315 steps :
1416 - name : Checkout code
1517 uses : actions/checkout@v2
@@ -105,4 +107,57 @@ jobs:
105107 - name : Cleanup configs
106108 run : |
107109 rm -rf /home/runner/.aws/credentials
108- rm -rf /home/runner/.aws/config
110+ rm -rf /home/runner/.aws/config
111+
112+ commit-release-notes :
113+ name : Record release on main
114+ runs-on : ubuntu-22.04
115+ needs : build
116+ permissions :
117+ contents : write
118+ steps :
119+ - name : Checkout main
120+ uses : actions/checkout@v4
121+ with :
122+ ref : main
123+ fetch-depth : 0
124+ token : ${{ secrets.GITHUB_TOKEN }}
125+
126+ - name : Commit release marker to main
127+ env :
128+ RELEASE_URL : ${{ needs.build.outputs.release_url }}
129+ run : |
130+ set -euo pipefail
131+
132+ # Strip refs/tags/ → e.g. v0.82.0
133+ TAG="${GITHUB_REF#refs/tags/}"
134+ RELEASE_DATE=$(date -u +'%-d %B %Y')
135+
136+ # Previous release tag = second-newest v* tag by semver sort.
137+ # `git tag --sort=-v:refname` puts the newest first; filter out the just-released tag.
138+ PREV=$(git tag --list 'v*' --sort=-v:refname | grep -v "^${TAG}$" | head -1 || true)
139+
140+ {
141+ printf 'chore(release): Open Install Library Release %s, %s\n\n' "$TAG" "$RELEASE_DATE"
142+ if [ -n "$PREV" ]; then
143+ printf 'Changes since %s:\n\n' "$PREV"
144+ git log --no-merges --pretty=format:'- %s (%h)' "${PREV}..${TAG}"
145+ printf '\n\n'
146+ fi
147+ printf 'Release: %s\n' "${RELEASE_URL}"
148+ } > /tmp/commit-msg.txt
149+
150+ echo "----- Commit message preview -----"
151+ cat /tmp/commit-msg.txt
152+ echo "----------------------------------"
153+
154+ git config user.name 'github-actions[bot]'
155+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
156+ git commit --allow-empty -F /tmp/commit-msg.txt
157+
158+ # Retry once on race (someone else pushed to main between checkout and push).
159+ if ! git push origin main; then
160+ echo "push rejected; refetching and rebasing before retry"
161+ git pull --rebase origin main
162+ git push origin main
163+ fi
0 commit comments