From 75135764fc2afd6b8180065b93511481e023a3c2 Mon Sep 17 00:00:00 2001 From: Lennard Golsch Date: Mon, 23 Nov 2026 14:11:01 +0100 Subject: [PATCH] feat: document the requirements of the deploy and release for projects without mycore-parent --- .github/workflows/maven-deploy.yml | 6 ++-- .github/workflows/maven-release.yml | 4 +-- docs/maven-build.md | 2 +- docs/maven-deploy.md | 43 +++++++++++++++++++++++++++++ docs/maven-release.md | 3 ++ 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml index 12c1d74..db1238d 100644 --- a/.github/workflows/maven-deploy.yml +++ b/.github/workflows/maven-deploy.yml @@ -145,7 +145,7 @@ jobs: org.apache.maven.plugins:maven-help-plugin:3.5.2:evaluate -Dexpression=maven-deploy-plugin.version \ -DforceStdout || true)" if [[ ! "$DEPLOY_PLUGIN" =~ ^3\.[1-9][0-9]*\.[0-9]+$ ]]; then - echo "::error::the parent manages no maven-deploy-plugin 3.1 or newer but '${DEPLOY_PLUGIN}', mycore-parent 57 or newer is required" + echo "::error::the property maven-deploy-plugin.version is no version 3.1 or newer but '${DEPLOY_PLUGIN}', set it in the pom or use mycore-parent 57 or newer" exit 1 fi echo "deploy-plugin-version=${DEPLOY_PLUGIN}" >> "$GITHUB_OUTPUT" @@ -169,12 +169,12 @@ jobs: [ -n "$DEPLOYED" ] || DEPLOYED="$(find "$STRAY" -type f -printf '%P ')" DEPLOYED="$(tr -d '[:cntrl:]' <<< "${DEPLOYED% }")" [ "${#DEPLOYED}" -le 200 ] || DEPLOYED="${DEPLOYED:0:200}..." - echo "::error::the build deployed ${DEPLOYED} without the central-publishing-maven-plugin, deploy-to-central of mycore-parent 57 or newer must stage every module" + echo "::error::the build deployed ${DEPLOYED} without the central-publishing-maven-plugin, it must stage every module, like deploy-to-central of mycore-parent 57 or newer" exit 1 fi # the hidden .index of the plugin is no snapshot, upload-artifact leaves it out if [ -z "$(find "$STAGING" -type f ! -name '.*' -print -quit 2> /dev/null)" ]; then - echo "::error::the build staged nothing in ${STAGING}, deploy-to-central of mycore-parent 57 or newer stages the snapshots" + echo "::error::the build staged nothing in ${STAGING}, the central-publishing-maven-plugin must stage the snapshots, like deploy-to-central of mycore-parent 57 or newer" exit 1 fi diff --git a/.github/workflows/maven-release.yml b/.github/workflows/maven-release.yml index 06989b3..424d310 100644 --- a/.github/workflows/maven-release.yml +++ b/.github/workflows/maven-release.yml @@ -376,14 +376,14 @@ jobs: [ -n "$DEPLOYED" ] || DEPLOYED="$(find "$STRAY" -type f -printf '%P ')" DEPLOYED="$(tr -d '[:cntrl:]' <<< "${DEPLOYED% }")" [ "${#DEPLOYED}" -le 200 ] || DEPLOYED="${DEPLOYED:0:200}..." - echo "::error::the build deployed ${DEPLOYED} without the central-publishing-maven-plugin, deploy-to-central of mycore-parent 57 or newer must stage every module" + echo "::error::the build deployed ${DEPLOYED} without the central-publishing-maven-plugin, it must stage every module, like deploy-to-central of mycore-parent 57 or newer" exit 1 fi # in the build directory of the first project with the plugin, usually the root mapfile -t BUNDLES < <(find . -name node_modules -prune -o -type f \ -path '*/target/central-publishing/central-bundle.zip' -print) if [ "${#BUNDLES[@]}" -ne 1 ]; then - echo "::error::the build created ${#BUNDLES[@]} bundles instead of one, deploy-to-central of mycore-parent 57 or newer creates it" + echo "::error::the build created ${#BUNDLES[@]} bundles instead of one, the central-publishing-maven-plugin must create it, like deploy-to-central of mycore-parent 57 or newer" exit 1 fi mv "${BUNDLES[0]}" "${RUNNER_TEMP}/central-bundle.zip" diff --git a/docs/maven-build.md b/docs/maven-build.md index 59ffb1f..89f0e7c 100644 --- a/docs/maven-build.md +++ b/docs/maven-build.md @@ -54,7 +54,7 @@ The workflow needs no secrets. The line is split at whitespace, quotes are not interpreted and patterns like `*` are passed on unchanged. 5. If the build fails or is cancelled and `failure-logs` is set, the matching files are uploaded as artifact `failure-logs-name`. -GitHub Actions sets `CI=true`. This activates the `ci` profile of `mycore-parent`, which among other things +GitHub Actions sets `CI=true`. With `mycore-parent` this activates its `ci` profile, which among other things verifies that the poms are sorted. Run `CI=true mvn verify` to reproduce such failures locally. ## Project setup diff --git a/docs/maven-deploy.md b/docs/maven-deploy.md index a97ebc8..d969bf8 100644 --- a/docs/maven-deploy.md +++ b/docs/maven-deploy.md @@ -53,6 +53,49 @@ No profile of the project may declare the `central-publishing-maven-plugin` with wins over `central-publishing-version`, knows no `skipUpload` and lets the build fail with an upload it has no credentials for. Remove such profiles when switching to this workflow. +### Without mycore-parent + +The workflow does not check the parent, only what the build does. A project with another parent, or without one, +deploys as well if its poms provide what `mycore-parent` brings: + +| Requirement | `mycore-parent` 57 or newer | +|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------| +| `mvn deploy` without `-P` runs the `central-publishing-maven-plugin` with `true` in every module | profile `deploy-to-central`, active without `skipDeployToCentral` | +| Its version is `${central-publishing-maven-plugin.version}`, so `central-publishing-version` replaces it | yes | +| The property `maven-deploy-plugin.version` is 3.1 or newer, the upload uses that version | yes | +| Modules that are not published are left out with `skipPublishing` or `excludeArtifacts` of the plugin | `skipPublishing` | + +```xml + + 0.12.0 + 3.1.4 + + + + + deploy-to-central + + + !skipDeployToCentral + + + + + + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} + true + + + + + +``` + +The snapshots still go to `https://central.sonatype.com/repository/maven-snapshots`, the upload ignores the +repositories of the poms. `groupId` and modules are checked as described in [How it works](#how-it-works). + ## Inputs | Input | Required | Default | Description | diff --git a/docs/maven-release.md b/docs/maven-release.md index 6b82afd..e24a373 100644 --- a/docs/maven-release.md +++ b/docs/maven-release.md @@ -69,6 +69,9 @@ Other project specific steps run in the caller after the release, using the `ver `central-publishing-version`, 0.12.0 or newer, the first version that creates the bundle without uploading it (`-DskipUpload=true`). No profile of the project may declare that plugin with a version of its own, like the old `deploy-to-sonatype` profiles of some plugins, see [`maven-deploy.yml`](maven-deploy.md#requirements). + Without `mycore-parent` the poms provide the same, see [Without mycore-parent](maven-deploy.md#without-mycore-parent). + The build of the tag must then attach sources and javadoc itself, Central requires them, and `build-args` names no + `release-profile`, e.g. `'-DskipTests'`. Set `dependency-property` to `''` if the project has no `mycore.version`. - An own `` section in the root `pom.xml` with `connection`, `developerConnection` and `url` of the repository. An inherited one points to the repository of the parent. - The [environment `release`](../README.md#the-environment-release) with the Central token and the signing key.