diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml index e3f2a95..c75e6dc 100644 --- a/.github/workflows/maven-deploy.yml +++ b/.github/workflows/maven-deploy.yml @@ -97,7 +97,7 @@ jobs: fi # pinned, mycore-parent does not manage it and Dependabot does not see it. # Maven writes its errors to stdout, they are printed if it fails - VERSION="$(mvn --batch-mode --no-transfer-progress -q -N \ + VERSION="$(mvn --batch-mode --no-transfer-progress --update-snapshots -q -N \ org.apache.maven.plugins:maven-help-plugin:3.5.2:evaluate -Dexpression=project.version -DforceStdout)" \ || { echo "$VERSION"; exit 1; } case "$VERSION" in @@ -111,8 +111,8 @@ jobs: # with the arguments of the build, whose profiles may add modules. Split at spaces and line breaks, so a # YAML block keeps all its arguments read -r -d '' -a ARGS <<< "$BUILD_ARGS" || true - mvn --batch-mode --no-transfer-progress versions:set -DnewVersion="$QUALIFIED" -DgenerateBackupPoms=false \ - "${ARGS[@]}" + mvn --batch-mode --no-transfer-progress --update-snapshots versions:set -DnewVersion="$QUALIFIED" \ + -DgenerateBackupPoms=false "${ARGS[@]}" echo "Deploying ${QUALIFIED}" # deploy-to-central of mycore-parent stages the snapshots, -DskipUpload=true keeps them in deferredDirectory @@ -128,7 +128,7 @@ jobs: set -euo pipefail # pinned, mycore-parent does not manage it and Dependabot does not see it. # Maven writes its errors to stdout, they are printed if it fails - VERSION="$(mvn --batch-mode --no-transfer-progress -q -N \ + VERSION="$(mvn --batch-mode --no-transfer-progress --update-snapshots -q -N \ org.apache.maven.plugins:maven-help-plugin:3.5.2:evaluate -Dexpression=project.version -DforceStdout)" \ || { echo "$VERSION"; exit 1; } # for a release the plugin would build a bundle for Central, which nothing uploads @@ -141,7 +141,7 @@ jobs: esac # deploy uploads with the maven-deploy-plugin the parent manages and checks the version again, # this only fails before the build - DEPLOY_PLUGIN="$(mvn --batch-mode --no-transfer-progress -q -N \ + DEPLOY_PLUGIN="$(mvn --batch-mode --no-transfer-progress --update-snapshots -q -N \ 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 @@ -157,7 +157,8 @@ jobs: # maven-deploy-plugin, into STRAY instead of a repository of its own. The plugin takes the release and # snapshot variants of altDeploymentRepository first, so all three are set STRAY="${RUNNER_TEMP}/stray-deploy" - mvn --batch-mode --no-transfer-progress deploy ${SKIP_TESTS_FLAG:+"$SKIP_TESTS_FLAG"} "${ARGS[@]}" \ + mvn --batch-mode --no-transfer-progress --update-snapshots deploy ${SKIP_TESTS_FLAG:+"$SKIP_TESTS_FLAG"} \ + "${ARGS[@]}" \ "-Dcentral-publishing-maven-plugin.version=${CENTRAL_PUBLISHING_VERSION}" -DskipUpload=true \ "-DdeferredDirectory=${STAGING}" "-DaltDeploymentRepository=stray::file://${STRAY}" \ "-DaltReleaseDeploymentRepository=stray::file://${STRAY}" \ diff --git a/docs/maven-deploy.md b/docs/maven-deploy.md index d97860d..993baec 100644 --- a/docs/maven-deploy.md +++ b/docs/maven-deploy.md @@ -102,6 +102,9 @@ with a secret: `maven-deploy-plugin`; `-DaltDeploymentRepository` and its release and snapshot variants send that into a directory of its own, and anything there fails the run. `build-args` cannot change where the snapshots go, only deploy uploads them. `versions:set` gets `build-args` as well. + - The checks, `versions:set` and the build run with `--update-snapshots`, so they get the newest snapshots of the + parent and the dependencies, e.g. of `mycore` after a [dispatch](dispatch-downstream.md). Without it, Maven + checks a snapshot once a day, and the restored Maven cache can hold one checked less than a day ago. - With `docker-images`, it builds the images and saves them for the job `images`. 2. **deploy** checks out the commit again, but only reads its poms, with [`snapshot-upload`](../.github/actions/snapshot-upload/action.yml).