2727 description : ' Next development version override (optional, must end with -SNAPSHOT)'
2828 required : false
2929 type : string
30+ changelogEntry :
31+ description : ' Changelog entry (Markdown bullets, e.g. "- Fix X"). Prepended to the module RELEASE.CHANGELOG.md in the version-bump PR and used as the GitHub Release notes. Required.'
32+ required : true
33+ type : string
3034 skip_publish :
3135 description : ' Skip publish (dry-run validation)'
3236 required : false
4852 MODULE : ${{ github.event.inputs.module }}
4953 RELEASE_VERSION_INPUT : ${{ github.event.inputs.releaseVersion }}
5054 DEVELOPMENT_VERSION_INPUT : ${{ github.event.inputs.developmentVersion }}
55+ CHANGELOG_ENTRY_INPUT : ${{ github.event.inputs.changelogEntry }}
5156 # Batch mode + no transfer-progress spam for every Maven call (Maven 3.9+).
5257 MAVEN_ARGS : " -B --no-transfer-progress"
5358 AWS_REGION : ${{ vars.AWS_REGION_MAVEN_RELEASE }}
@@ -252,6 +257,34 @@ jobs:
252257 -Darguments="-gs $MAVEN_SETTINGS -Prelease -Dgpg.keyname=$GPG_KEYNAME -Dgpg.passphrase=$GPG_PASSPHRASE" \
253258 --file "$MODULE/pom.xml"
254259
260+ # Bump the lastPublished comment under <version>; rides in the bump PR.
261+ - name : Record last published version in POM
262+ if : ${{ github.event.inputs.skip_publish != 'true' }}
263+ run : |
264+ if ! grep -q "<!-- lastPublished:" "$MODULE/pom.xml"; then
265+ echo "::notice::$MODULE has no lastPublished comment; skipping"
266+ exit 0
267+ fi
268+ sed -i "s|<!-- lastPublished:.*-->|<!-- lastPublished: ${EFFECTIVE_RELEASE_VERSION} (auto-updated by release.yml) -->|" "$MODULE/pom.xml"
269+ git commit -am "chore(release): record ${MODULE} lastPublished=${EFFECTIVE_RELEASE_VERSION}"
270+
271+ # Prepend the changelog entry so it ships in the version-bump PR. Passed
272+ # via env, never interpolated into the script, so it can't inject shell.
273+ - name : Prepend changelog entry
274+ if : ${{ github.event.inputs.skip_publish != 'true' }}
275+ run : |
276+ CHANGELOG="$MODULE/RELEASE.CHANGELOG.md"
277+ TMP="$(mktemp)"
278+ {
279+ echo "### $(date +'%B %d, %Y')"
280+ echo "\`${EFFECTIVE_RELEASE_VERSION}\`:"
281+ printf '%s\n\n' "$CHANGELOG_ENTRY_INPUT"
282+ [ -f "$CHANGELOG" ] && cat "$CHANGELOG"
283+ } > "$TMP"
284+ mv "$TMP" "$CHANGELOG"
285+ git add "$CHANGELOG"
286+ git commit -m "docs(release): add ${MODULE} ${EFFECTIVE_RELEASE_VERSION} changelog entry"
287+
255288 # main is protected (no direct push), so push the tag and open a PR for
256289 # the version-bump commits instead. Skipping this would leave the POM on
257290 # the just-released -SNAPSHOT.
@@ -273,6 +306,22 @@ jobs:
273306 --title "chore(release): ${MODULE} ${EFFECTIVE_RELEASE_VERSION}" \
274307 --body "Post-release version bump for ${MODULE} ${EFFECTIVE_RELEASE_VERSION} (already on Maven Central, tag ${TAG} pushed)."
275308
309+ # GitHub Release on the pushed tag: changelog entry + Central link.
310+ - name : Create GitHub Release
311+ if : ${{ github.event.inputs.skip_publish != 'true' }}
312+ env :
313+ GH_TOKEN : ${{ github.token }}
314+ run : |
315+ TAG="${MODULE}-${EFFECTIVE_RELEASE_VERSION}"
316+ NOTES="$(mktemp)"
317+ {
318+ printf '%s\n\n' "$CHANGELOG_ENTRY_INPUT"
319+ echo "Published to Maven Central: https://central.sonatype.com/artifact/com.amazonaws/${MODULE}/${EFFECTIVE_RELEASE_VERSION}"
320+ } > "$NOTES"
321+ gh release create "$TAG" \
322+ --title "${MODULE} ${EFFECTIVE_RELEASE_VERSION}" \
323+ --notes-file "$NOTES"
324+
276325 - name : Dry-run release (prepare only, no publish)
277326 if : ${{ github.event.inputs.skip_publish == 'true' }}
278327 run : |
0 commit comments