-
Notifications
You must be signed in to change notification settings - Fork 242
feat(release): add changelog entry, GitHub Releases, lastPublished, a… #640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fabisev
wants to merge
18
commits into
main
Choose a base branch
from
fabisev/release-changelog-and-github-releases
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+340
−71
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
cf830ff
feat(release): add changelog entry, GitHub Releases, lastPublished, a…
fabisev 3bde5cb
Merge branch 'main' into fabisev/release-changelog-and-github-releases
fabisev 555b3f5
build: centralize module versions in a parent POM
fabisev cff1683
Merge branch 'main' into fabisev/release-changelog-and-github-releases
fabisev 45420b7
Merge branch 'main' into fabisev/release-changelog-and-github-releases
fabisev 5d51046
refactor(release): address PR review on parent POM and workflow
fabisev ce9f80b
docs(release): shorten version-map comment
fabisev 5a6a528
chore(release): set meaningful Central deploymentName (GAV)
fabisev f980a36
feat(release): attach signed jars + verify notes to GitHub Release
fabisev 0d41205
Merge branch 'main' into fabisev/release-changelog-and-github-releases
fabisev fb9da27
refactor(release): split shared parent POM into a follow-up PR
fabisev 9bc7a4a
Merge remote-tracking branch 'origin/fabisev/release-changelog-and-gi…
fabisev 91ebbbc
feat(release): attach signed jars to GitHub Releases
fabisev e9d9111
Merge branch 'main' into fabisev/release-changelog-and-github-releases
fabisev 7363371
fix(release): validate release version and keep GPG passphrase off argv
fabisev 649ce7e
chore(release): squash post-release bump into one commit
fabisev b3d7b5b
Merge remote-tracking branch 'origin/fabisev/release-changelog-and-gi…
fabisev baa4cd5
refactor(release): centralize release tag in TAG_NAME
fabisev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| name: "Create GitHub Release with signed assets" | ||
| description: > | ||
| Creates a GitHub Release on an already-pushed tag. Builds the release notes | ||
| from the changelog entry, a Maven Central link, and GPG verification | ||
| instructions, then attaches the signed jars and their detached .asc | ||
| signatures (byte-for-byte the same signatures uploaded to Maven Central). The | ||
| attachment set is derived from the .asc files, so only signed, published | ||
| artifacts are attached (unsigned intermediates like shade's original-*.jar are | ||
| skipped). No re-signing happens here. | ||
|
|
||
| inputs: | ||
| tag: | ||
| description: "Git tag the release is created on (already pushed)." | ||
| required: true | ||
| title: | ||
| description: "Release title." | ||
| required: true | ||
| module: | ||
| description: "Module artifactId (used for the Central link and verify example)." | ||
| required: true | ||
| version: | ||
| description: "Released version." | ||
| required: true | ||
| changelog-entry: | ||
| description: "Markdown changelog entry used as the lead of the release notes." | ||
| required: true | ||
| fingerprint: | ||
| description: "Public GPG key fingerprint, shown in the verification instructions." | ||
| required: true | ||
| artifact-dir: | ||
| description: > | ||
| Directory (searched non-recursively) holding the signed jars and their | ||
| .asc siblings. For release:perform this is <module>/target/checkout/target; | ||
| for an in-place deploy it is <module>/target. | ||
| required: true | ||
| extra-notes: | ||
| description: "Optional Markdown inserted between the changelog and the Central link (e.g. an artifact inventory)." | ||
| required: false | ||
| default: "" | ||
| github-token: | ||
| description: "Token for the gh CLI (typically github.token)." | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Create GitHub Release | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.github-token }} | ||
| TAG: ${{ inputs.tag }} | ||
| RELEASE_TITLE: ${{ inputs.title }} | ||
| REL_MODULE: ${{ inputs.module }} | ||
| REL_VERSION: ${{ inputs.version }} | ||
| CHANGELOG_ENTRY: ${{ inputs.changelog-entry }} | ||
| GPG_FINGERPRINT: ${{ inputs.fingerprint }} | ||
| ARTIFACT_DIR: ${{ inputs.artifact-dir }} | ||
| EXTRA_NOTES: ${{ inputs.extra-notes }} | ||
| run: | | ||
| NOTES="$(mktemp)" | ||
| { | ||
| printf '%s\n\n' "$CHANGELOG_ENTRY" | ||
| if [ -n "$EXTRA_NOTES" ]; then | ||
| printf '%s\n\n' "$EXTRA_NOTES" | ||
| fi | ||
| echo "Published to Maven Central: https://central.sonatype.com/artifact/com.amazonaws/${REL_MODULE}/${REL_VERSION}" | ||
| echo | ||
| echo "## Verifying the signatures" | ||
| echo | ||
| echo "The attached \`.jar.asc\` files are the same GPG signatures published to Maven Central, made with the AWS Lambda Java release signing key." | ||
| echo | ||
| echo '```sh' | ||
| echo "# Import the public signing key" | ||
| echo "gpg --keyserver keys.openpgp.org --recv-keys ${GPG_FINGERPRINT}" | ||
| echo "# Verify a downloaded jar against its signature" | ||
| echo "gpg --verify ${REL_MODULE}-${REL_VERSION}.jar.asc ${REL_MODULE}-${REL_VERSION}.jar" | ||
| echo '```' | ||
| } > "$NOTES" | ||
|
|
||
| # Attach the signed jars + their detached GPG signatures. Deriving the | ||
| # list from the .asc set means only signed, published artifacts are | ||
| # attached (skips unsigned intermediates like shade's original-*.jar). | ||
| ASSETS=() | ||
| while IFS= read -r sig; do | ||
| ASSETS+=("${sig%.asc}" "$sig") | ||
| done < <(find "$ARTIFACT_DIR" -maxdepth 1 -type f -name '*.jar.asc' 2>/dev/null | sort) | ||
| if [ ${#ASSETS[@]} -eq 0 ]; then | ||
| echo "::warning::No signed jars found under $ARTIFACT_DIR; creating the release without attachments" | ||
| fi | ||
|
|
||
| gh release create "$TAG" \ | ||
| --title "$RELEASE_TITLE" \ | ||
| --notes-file "$NOTES" \ | ||
| "${ASSETS[@]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: "Use the runner image's preinstalled Corretto 8" | ||
| description: > | ||
| Points JAVA_HOME/PATH at the CodeBuild image's preinstalled Corretto 8 | ||
| ($JAVA_8_HOME) and writes a Maven toolchains.xml for JDK 8. The image defaults | ||
| JAVA_HOME to Java 25, so this is required before any Maven call. Avoids | ||
| actions/setup-java, which fetches from corretto.github.io + corretto.aws, both | ||
| blocked by the runner egress lock. $JAVA_8_HOME resolves per-arch | ||
| (x86_64/aarch64). | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Use the runner image's preinstalled Corretto 8 | ||
| shell: bash | ||
| run: | | ||
| echo "JAVA_HOME=$JAVA_8_HOME" >> "$GITHUB_ENV" | ||
| echo "$JAVA_8_HOME/bin" >> "$GITHUB_PATH" | ||
| "$JAVA_8_HOME/bin/java" -version | ||
| mkdir -p "$HOME/.m2" | ||
| cat > "$HOME/.m2/toolchains.xml" <<EOF | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <toolchains> | ||
| <toolchain> | ||
| <type>jdk</type> | ||
| <provides><version>8</version></provides> | ||
| <configuration><jdkHome>$JAVA_8_HOME</jdkHome></configuration> | ||
| </toolchain> | ||
| </toolchains> | ||
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,10 @@ on: | |
| description: 'Next development version override (optional, must end with -SNAPSHOT)' | ||
| required: false | ||
| type: string | ||
| changelogEntry: | ||
| 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.' | ||
| required: true | ||
| type: string | ||
| skip_publish: | ||
| description: 'Skip publish (dry-run validation)' | ||
| required: false | ||
|
|
@@ -38,6 +42,7 @@ env: | |
| MODULE: aws-lambda-java-runtime-interface-client | ||
| RELEASE_VERSION_INPUT: ${{ github.event.inputs.releaseVersion }} | ||
| DEVELOPMENT_VERSION_INPUT: ${{ github.event.inputs.developmentVersion }} | ||
| CHANGELOG_ENTRY_INPUT: ${{ github.event.inputs.changelogEntry }} | ||
| MAVEN_ARGS: "-B --no-transfer-progress" | ||
| AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} | ||
| OIDC_ROLE_ARN: ${{ secrets.AWS_ROLE_MAVEN_RELEASE }} | ||
|
|
@@ -75,27 +80,8 @@ jobs: | |
|
|
||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
|
|
||
| # Use the CodeBuild image's preinstalled Corretto 8. The image ships it at | ||
| # $JAVA_8_HOME but defaults JAVA_HOME to Java 25, so point JAVA_HOME/PATH at | ||
| # 8. Avoids actions/setup-java, which fetches from corretto.github.io + | ||
| # corretto.aws, both blocked by the runner egress lock. $JAVA_8_HOME | ||
| # resolves per-arch (x86_64/aarch64). | ||
| - name: Use the runner image's preinstalled Corretto 8 | ||
| run: | | ||
| echo "JAVA_HOME=$JAVA_8_HOME" >> "$GITHUB_ENV" | ||
| echo "$JAVA_8_HOME/bin" >> "$GITHUB_PATH" | ||
| "$JAVA_8_HOME/bin/java" -version | ||
| mkdir -p "$HOME/.m2" | ||
| cat > "$HOME/.m2/toolchains.xml" <<EOF | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <toolchains> | ||
| <toolchain> | ||
| <type>jdk</type> | ||
| <provides><version>8</version></provides> | ||
| <configuration><jdkHome>$JAVA_8_HOME</jdkHome></configuration> | ||
| </toolchain> | ||
| </toolchains> | ||
| EOF | ||
| uses: ./.github/actions/setup-corretto8 | ||
|
|
||
| # Route all mvn resolution through the CodeArtifact mirror. Must precede | ||
| # resolve-release-version, which invokes `mvn help:evaluate`. Ambient | ||
|
|
@@ -160,31 +146,21 @@ jobs: | |
| environment: Release | ||
| timeout-minutes: 30 | ||
| steps: | ||
| # Defence-in-depth: build-natives already gates on main, but this job does | ||
| # the actual publish/tag/push on a separate runner, so re-verify here too. | ||
| - name: Verify release branch | ||
| run: | | ||
| if [[ "$GITHUB_REF_NAME" != "main" ]]; then | ||
| echo "::error::Releases must run from the main branch, got '$GITHUB_REF_NAME'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| fetch-depth: 0 # full history for tagging/pushing | ||
|
|
||
| # Use the CodeBuild image's preinstalled Corretto 8. The image ships it at | ||
| # $JAVA_8_HOME but defaults JAVA_HOME to Java 25, so point JAVA_HOME/PATH at | ||
| # 8. Avoids actions/setup-java, which fetches from corretto.github.io + | ||
| # corretto.aws, both blocked by the runner egress lock. $JAVA_8_HOME | ||
| # resolves per-arch (x86_64/aarch64). | ||
| - name: Use the runner image's preinstalled Corretto 8 | ||
| run: | | ||
| echo "JAVA_HOME=$JAVA_8_HOME" >> "$GITHUB_ENV" | ||
| echo "$JAVA_8_HOME/bin" >> "$GITHUB_PATH" | ||
| "$JAVA_8_HOME/bin/java" -version | ||
| mkdir -p "$HOME/.m2" | ||
| cat > "$HOME/.m2/toolchains.xml" <<EOF | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <toolchains> | ||
| <toolchain> | ||
| <type>jdk</type> | ||
| <provides><version>8</version></provides> | ||
| <configuration><jdkHome>$JAVA_8_HOME</jdkHome></configuration> | ||
| </toolchain> | ||
| </toolchains> | ||
| EOF | ||
| uses: ./.github/actions/setup-corretto8 | ||
|
|
||
| # Route all mvn resolution through the CodeArtifact mirror. Must precede | ||
| # resolve-release-version (which invokes `mvn help:evaluate`) and the OIDC | ||
|
|
@@ -304,6 +280,10 @@ jobs: | |
| gpgconf --kill gpg-agent || true | ||
| gpg --batch --import <<< "$GPG_PRIVATE_KEY" | ||
| GPG_KEYNAME=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/ {print $5; exit}') | ||
| # Publish the primary key fingerprint (NOT secret) for the GitHub | ||
| # Release verification instructions. Only the public fingerprint | ||
| # crosses $GITHUB_ENV here; the passphrase and token never do. | ||
| echo "GPG_FINGERPRINT=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr:/ {print $10; exit}')" >> "$GITHUB_ENV" | ||
|
|
||
| # Global settings holding only the Sonatype "central" server for upload. | ||
| # Passed to Maven as -gs (global) so it MERGES with the CodeArtifact | ||
|
|
@@ -319,9 +299,13 @@ jobs: | |
| } > "$MAVEN_SETTINGS" | ||
|
|
||
| # --- Publish --- (-gs: merge Sonatype creds with the ~/.m2 mirror) | ||
| # Pass the passphrase via MAVEN_GPG_PASSPHRASE (read natively by | ||
| # maven-gpg-plugin) rather than -Dgpg.passphrase, so it never lands in | ||
| # the process argument list. | ||
| export MAVEN_GPG_PASSPHRASE="$GPG_PASSPHRASE" | ||
| mvn deploy -Prelease -DskipTests -DmultiArch=false \ | ||
| -gs "$MAVEN_SETTINGS" \ | ||
| -Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \ | ||
| -Dgpg.keyname="$GPG_KEYNAME" \ | ||
| --file "$MODULE/pom.xml" | ||
|
|
||
| # main is protected (no direct push), so push the tag (tag pushes aren't | ||
|
|
@@ -339,9 +323,26 @@ jobs: | |
| git commit -am "chore(ric): release ${EFFECTIVE_RELEASE_VERSION}" | ||
| git tag "$TAG_NAME" | ||
|
|
||
| # Next development version commit. | ||
| # Single post-release commit: next development version bump, the | ||
| # lastPublished marker, and the changelog entry. Sits on top of the | ||
| # tag, so the tagged release commit is untouched. The changelog entry | ||
| # is passed via env, never interpolated into the script, so it can't | ||
| # inject shell. | ||
| mvn versions:set -DnewVersion="$NEXT_DEV_VERSION" -DgenerateBackupPoms=false --file "$MODULE/pom.xml" | ||
| git commit -am "chore(ric): prepare next development ${NEXT_DEV_VERSION}" | ||
| if grep -q "<!-- lastPublished:" "$MODULE/pom.xml"; then | ||
| sed -i "s|<!-- lastPublished:.*-->|<!-- lastPublished: ${EFFECTIVE_RELEASE_VERSION} (auto-updated by release-runtime-interface-client.yml) -->|" "$MODULE/pom.xml" | ||
| fi | ||
| CHANGELOG="$MODULE/RELEASE.CHANGELOG.md" | ||
| TMP="$(mktemp)" | ||
| { | ||
| echo "### $(date +'%B %d, %Y')" | ||
| echo "\`${EFFECTIVE_RELEASE_VERSION}\`:" | ||
| printf '%s\n\n' "$CHANGELOG_ENTRY_INPUT" | ||
| [ -f "$CHANGELOG" ] && cat "$CHANGELOG" | ||
| } > "$TMP" | ||
| mv "$TMP" "$CHANGELOG" | ||
| git add "$CHANGELOG" | ||
| git commit -am "chore(release): prepare next development, record ${MODULE} ${EFFECTIVE_RELEASE_VERSION} lastPublished and changelog" | ||
|
|
||
| # Tag push isn't gated by branch protection; the version-bump commits | ||
| # go to a release branch and land on main via PR. | ||
|
|
@@ -354,6 +355,24 @@ jobs: | |
| --title "chore(release): ${MODULE} ${EFFECTIVE_RELEASE_VERSION}" \ | ||
| --body "Post-release version bump for ${MODULE} ${EFFECTIVE_RELEASE_VERSION} (already on Maven Central, tag ${TAG_NAME} pushed)." | ||
|
Comment on lines
330
to
356
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can probably extract this. This is really similar code to the one in release. |
||
|
|
||
| # GitHub Release on the pushed tag: the signed artifacts (byte-for-byte the | ||
| # same detached GPG signatures uploaded to Maven Central) + verification | ||
| # instructions. `mvn deploy` signed in place, so the jars and their .asc | ||
| # siblings are in the module target dir and need no re-signing. | ||
| - name: Create GitHub Release | ||
| if: ${{ github.event.inputs.skip_publish != 'true' }} | ||
| uses: ./.github/actions/create-github-release | ||
| with: | ||
| tag: ${{ env.TAG_NAME }} | ||
| title: ${{ env.MODULE }} ${{ env.EFFECTIVE_RELEASE_VERSION }} | ||
| module: ${{ env.MODULE }} | ||
| version: ${{ env.EFFECTIVE_RELEASE_VERSION }} | ||
| changelog-entry: ${{ env.CHANGELOG_ENTRY_INPUT }} | ||
| fingerprint: ${{ env.GPG_FINGERPRINT }} | ||
| artifact-dir: ${{ env.MODULE }}/target | ||
| extra-notes: "Artifacts: main JAR + linux/linux_musl x x86_64/aarch_64 native classifier JARs." | ||
| github-token: ${{ github.token }} | ||
|
|
||
| # Dry-run: validate assembly, no publish/push. | ||
| - name: Dry-run assemble (no publish) | ||
| if: ${{ github.event.inputs.skip_publish == 'true' }} | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see the plugin
maven-gpg-pluginversion are all v1.5, does it support this new feature? Do we need to bump the version ofmaven-gpg-pluginas well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. The example provided here is with the new version which is 3.2.8
https://maven.apache.org/plugins/maven-gpg-plugin/usage.html
This seems to me something we can add later. Can we descope it in another PR?