Skip to content

Latest commit

 

History

History
165 lines (125 loc) · 6.84 KB

RELEASING.md

File metadata and controls

165 lines (125 loc) · 6.84 KB

Releasing

Every Java module that applies buildlogic.publish-conventions is published to Maven Central (Central Portal) under com.codeheadsystems, in one deployment, at one shared version. Today that is:

  • config-bom
  • config-model
  • config-datastore
  • config-datastore-sql
  • config-datastore-dynamodb
  • config-datastore-s3
  • config-datastore-testkit
  • config-library
  • config-client (its generated HTTP layer is compiled into its jar and sources jar)

./gradlew verifyPublishConfig lists them. A module joins by applying the plugin and adding a constraint to config-bom. config-server, config-integ, config-test-oidc and the config-datastore-etcd placeholder are never published. The Rust crates are not published either.

The workflows below only run when a tag is pushed or a release is started by hand. Each release needs an entry in CHANGELOG.md; see "Before releasing".

How the version is chosen

  • gradle.properties holds the next version as a SNAPSHOT (0.1.0-SNAPSHOT).
  • A vX.Y.Z or vX.Y.Z-suffix tag on HEAD overrides it (settings.gradle.kts), so a tagged build is X.Y.Z. Without a tag, builds stay SNAPSHOT and are never signed.

One-time setup

1. Central Portal

  1. Sign in at https://central.sonatype.com. The com.codeheadsystems namespace is already verified (hofmann-elimination publishes under it), so the same account works.
  2. Account page, Generate User Token. Save the token's username and password. They are not your login credentials.

2. GPG key

The hofmann-elimination key can be reused. To make a new one:

gpg --gen-key                                    # RSA, 4096 bits
gpg --list-secret-keys --keyid-format=long       # sec rsa4096/ABCD1234EFGH5678
gpg --export-secret-keys ABCD1234EFGH5678 | base64 -w 0 > private-key.txt
gpg --keyserver keyserver.ubuntu.com --send-keys ABCD1234EFGH5678
gpg --keyserver keys.openpgp.org --send-keys ABCD1234EFGH5678

3. GitHub secrets

These are organization secrets of codeheadsystems, shared with its other publishing repos and already set (https://github.com/organizations/codeheadsystems/settings/secrets/actions). A repository secret of the same name would override one. gh secret list shows only repository secrets, so it lists none here; gh api repos/codeheadsystems/config/actions/organization-secrets lists the ones this repo can use.

Secret Value
CENTRAL_PORTAL_USERNAME User token username
CENTRAL_PORTAL_PASSWORD User token password
GPG_PRIVATE_KEY Contents of private-key.txt (base64)
GPG_PASSPHRASE The key's passphrase
GPG_KEY_ID The key ID, such as EFGH5678

Delete private-key.txt once it is uploaded.

Before releasing

  1. In CHANGELOG.md, rename ## [Unreleased] to ## [X.Y.Z] - YYYY-MM-DD (the release day), add a new empty ## [Unreleased] above it, and update the compare links at the bottom. A pre-release such as X.Y.Z-rc.1 uses the X.Y.Z entry unless it has its own.
  2. Check the entry the release notes will use: .github/scripts/changelog-section.sh X.Y.Z.
  3. Commit that to main.

Both release paths refuse a version without an entry: manual release before it tags, and publish.yml before it builds.

Releasing

Releases are published only from commits on main; publish.yml refuses anything else.

By tag

git checkout main && git pull
./gradlew clean build
git tag -a v0.1.0 -m "Release 0.1.0"     # or v0.1.0-rc.1 for a pre-release
git push origin v0.1.0

release.yml runs on the tag.

From the Actions tab

Run manual release. It tags the head of main with the next patch version (the latest vX.Y.Z plus one; for the first release, gradle.properties' version without -SNAPSHOT), then publishes it.

What the release does

Both paths run .github/workflows/publish.yml:

  1. Checks the tag format, that CHANGELOG.md has an entry for the version, and that the tagged commit is on main.
  2. Checks that Gradle's version equals the tag's.
  3. ./gradlew clean build: all tests, including the backend and end-to-end tests in Docker and the Rust client scenarios (cargo comes preinstalled on GitHub's Ubuntu runners). CI is set there, so a missing Docker or cargo fails the release instead of skipping tests.
  4. Imports the GPG key and runs ./gradlew publishAggregationToCentralPortal, which signs and uploads every module as one deployment.
  5. Removes the signing material from the runner.
  6. Creates the GitHub release: the changelog entry, then how to depend on it, the module list and jars, then GitHub's generated list of merged pull requests. A tag with a suffix is marked as a pre-release.

Artifacts reach Maven Central in 15 to 120 minutes. Check https://repo1.maven.org/maven2/com/codeheadsystems/config-bom/ and the Deployments page at https://central.sonatype.com.

After a release, raise version in gradle.properties to the next SNAPSHOT, and record changes under ## [Unreleased] in CHANGELOG.md as they land.

Checking locally

Nothing here uploads.

./gradlew verifyPublishConfig                     # coordinates of every published module
./gradlew -Pversion=0.1.0 nmcpZipAggregation      # the exact bundle a release uploads
unzip -l build/nmcp/zip/aggregation.zip
./gradlew -Pversion=0.1.0 nmcpCheckAggregationFiles

The bundle is signed if ~/.gradle/gradle.properties has signing.gnupg.keyName (and signing.gnupg.passphrase); otherwise the .asc files are missing, which is fine for checking everything else.

To try the tag-to-version logic:

git tag v0.0.0-test && ./gradlew properties -q | grep '^version:'   # version: 0.0.0-test
git tag -d v0.0.0-test

Troubleshooting

  • "CHANGELOG.md has no entry for X.Y.Z": add the section (see "Before releasing") and commit it. With a pushed tag, delete the tag (git push --delete origin vX.Y.Z) and tag the new commit. Manual release tags the latest vX.Y.Z plus one patch, so its entry must be for that version.
  • "Gradle version does not match the tag": the tag is not on the checked-out commit, or is not vX.Y.Z[-suffix]. Check git describe --tags --exact-match HEAD.
  • "is not on main": the tag points at a commit that has not landed on main. Delete the tag (git push --delete origin vX.Y.Z) and tag a commit on main.
  • GPG errors ("No secret key", "Inappropriate ioctl"): check GPG_PRIVATE_KEY is base64, GPG_KEY_ID matches it, and the public key is on the keyservers.
  • 401 from the Central Portal: the secrets must be the user token, not the login. Regenerate it on the Account page.
  • Deployment fails validation: see its errors under Deployments at https://central.sonatype.com, fix, delete the tag, and release again.

A published version cannot be removed from Maven Central. Fix a bad release with a new patch version.