Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docs/maven-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions docs/maven-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<extensions>true</extensions>` 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
<properties>
<central-publishing-maven-plugin.version>0.12.0</central-publishing-maven-plugin.version>
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
</properties>

<profiles>
<profile>
<id>deploy-to-central</id>
<activation>
<property>
<name>!skipDeployToCentral</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
```

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 |
Expand Down
3 changes: 3 additions & 0 deletions docs/maven-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<scm>` 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.
Expand Down