|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +export RELEASE_VERSION="${RELEASE_VERSION:-}" |
| 5 | +export POST_RELEASE_VERSION="${POST_RELEASE_VERSION:-}" |
| 6 | + |
| 7 | +export VERSION="${RELEASE_VERSION}" |
| 8 | +export FOO_SEC="${FOO_SEC:-}" |
| 9 | +export FOO_PUB="${FOO_PUB:-}" |
| 10 | +export FOO_PASSPHRASE="${FOO_PASSPHRASE:-}" |
| 11 | +export SONATYPE_USER="${SONATYPE_USER:-}" |
| 12 | +export SONATYPE_PASSWORD="${SONATYPE_PASSWORD:-}" |
| 13 | + |
| 14 | +temporaryDir="$(mktemp -d)" |
| 15 | +trap "{ rm -rf ${temporaryDir}; }" EXIT |
| 16 | + |
| 17 | +if echo $VERSION | egrep -q 'M|RC'; then |
| 18 | + echo Activating \"milestone\" profile for version=\"$VERSION\" |
| 19 | + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone" |
| 20 | +elif echo $VERSION | egrep -q 'SNAPSHOT'; then |
| 21 | + echo "Version is a snapshot one - will not add any additional profiles for version=\"$VERSION\" " |
| 22 | +else |
| 23 | + echo Activating \"central\" profile for version=\"$VERSION\" |
| 24 | + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral" |
| 25 | +fi |
| 26 | + |
| 27 | +MAVEN_ARGS="${MAVEN_ARGS} -Dgpg.secretKeyring="$FOO_SEC" -Dgpg.publicKeyring="$FOO_PUB" -Dgpg.passphrase="$FOO_PASSPHRASE" -DSONATYPE_USER="$SONATYPE_USER" -DSONATYPE_PASSWORD="$SONATYPE_PASSWORD"" |
| 28 | + |
| 29 | +echo "Will set the following Maven Args [${MAVEN_ARGS}]" |
| 30 | + |
| 31 | +echo -e "\n\nUpdate the project versions to ${RELEASE_VERSION}\n\n" |
| 32 | + |
| 33 | +otelVersion="${RELEASE_VERSION}" && ./mvnw versions:set -DnewVersion="${otelVersion}" -DgenerateBackupPoms=false && pushd spring-cloud-sleuth-otel-dependencies && ../mvnw versions:set -DnewVersion="${otelVersion}" -DgenerateBackupPoms=false && popd && pushd benchmarks && ../mvnw versions:set -DnewVersion="${otelVersion}" -DgenerateBackupPoms=false && popd |
| 34 | + |
| 35 | +echo -e "\n\nBuild the project\n\n" |
| 36 | + |
| 37 | +./mvnw clean install $MAVEN_ARGS |
| 38 | + |
| 39 | +echo -e "\n\nUpload artifacts\n\n" |
| 40 | + |
| 41 | +./mvnw deploy $MAVEN_ARGS -DskipTests |
| 42 | + |
| 43 | +echo -e "\n\nCommit and tag\n\n" |
| 44 | + |
| 45 | +git commit -am "Bumped versions for the ${otelVersion} release" && git tag "v${otelVersion}" |
| 46 | + |
| 47 | +echo -e "\n\nGenerate docs\n\n" |
| 48 | + |
| 49 | +./mvnw clean install -Pdocs -pl docs && cp -r docs/target/generated-docs/* "${temporaryDir}" && git checkout gh-pages && git reset --hard origin/gh-pages && rm -rf "docs/${otelVersion}" && mkdir -p "docs/${otelVersion}" && cp -rf "${temporaryDir}"/* "docs/${otelVersion}/" && pushd docs && rm current && ln -s "${otelVersion}" current && git add . && git commit -m "Updated site" && git push origin gh-pages |
| 50 | + |
| 51 | +echo -e "\n\nUpdate the project versions to a post release version ${POST_RELEASE_VERSION}\n\n" |
| 52 | + |
| 53 | +otelVersion="${POST_RELEASE_VERSION}" && ./mvnw versions:set -DnewVersion="${otelVersion}" -DgenerateBackupPoms=false && pushd spring-cloud-sleuth-otel-dependencies && ../mvnw versions:set -DnewVersion="${otelVersion}" -DgenerateBackupPoms=false && popd && pushd benchmarks && ../mvnw versions:set -DnewVersion="${otelVersion}" -DgenerateBackupPoms=false && popd |
0 commit comments