From c5d2eb9a4c3256ead255cd5db9947caac2020308 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 12 May 2022 17:57:59 +0200 Subject: [PATCH] Update release scripts (#648) --- RELEASING.adoc | 15 ++++-- build/publish-on-homebrew.sh | 62 ++++++++++++++++++++++ build/publish-on-sdkman.sh | 12 +++-- build/{release.sh => release-build.sh} | 0 build/{publish.sh => release-candidate.sh} | 0 build/release-publish.sh | 38 +++++++++++++ 6 files changed, 120 insertions(+), 7 deletions(-) create mode 100755 build/publish-on-homebrew.sh rename build/{release.sh => release-build.sh} (100%) rename build/{publish.sh => release-candidate.sh} (100%) create mode 100755 build/release-publish.sh diff --git a/RELEASING.adoc b/RELEASING.adoc index e5ccc022..78bd8926 100644 --- a/RELEASING.adoc +++ b/RELEASING.adoc @@ -3,14 +3,21 @@ * Run the https://raw.githubusercontent.com/apache/maven-mvnd/master/build/release.sh[release script] which will update the versions, the changelog, the native binaries and will tag the new git commit. This new tag will trigger the https://raw.githubusercontent.com/apache/maven-mvnd/master/.github/workflows/release.yaml[release workflow] on this newly created tag. [source,shell] ---- -./build/release.sh +./build/release-build.sh ---- -* Once the workflow completes, run the https://raw.githubusercontent.com/apache/maven-mvnd/master/build/publish.sh[publish script] which will download the built assemblies, compute the checksums and signatures and commit them to the https://dist.apache.org/repos/dist/dev/maven/mvnd/[dev distribution repository] +* Once the workflow completes, run the https://raw.githubusercontent.com/apache/maven-mvnd/master/build/release-candidate.sh[release-candidate script] which will download the built assemblies, compute the checksums and signatures and commit them to the https://dist.apache.org/repos/dist/dev/maven/mvnd/[dev distribution repository] https://github.com/apache/maven-mvnd/releases[releases]. +[source,shell] +---- +./build/release-candidate.sh +---- You can now call a vote on the mailto:dev@maven.apache.org[dev mailing list] pointing to that release candidate. -* Once the vote passes, publish the release. - +* Once the vote passes, publish the release using the following command: +[source,shell] +---- +./build/release-publish.sh +---- WARNING: *TODO*: document the publication process (move to the final svn area, homebrew, sdkman, choco updates...) diff --git a/build/publish-on-homebrew.sh b/build/publish-on-homebrew.sh new file mode 100755 index 00000000..e982bb4e --- /dev/null +++ b/build/publish-on-homebrew.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# +# Copyright 2019 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e +export VERSION=$1 + +if [ "${VERSION}x" = "x" ] +then + echo "Specify the version: $0 [version]" + exit 1 +fi + +rm -Rf target/releases/${VERSION} +mkdir -p target/releases/${VERSION} +pushd target/releases + +darwinZipUrl="https://dist.apache.org/repos/dist/release/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-darwin-amd64.zip" +darwinSha256="$(curl -L --silent "${darwinZipUrl}.sha256")" +linuxZipUrl="https://dist.apache.org/repos/dist/release/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-linux-amd64.zip" +linuxSha256="$(curl -L --silent "${linuxZipUrl}.sha256")" + +echo "Updating Formula/mvnd.rb with" +echo "version: ${VERSION}" +echo "darwin-url: ${darwinZipUrl}" +echo "darwin-sha256: ${darwinSha256}" +echo "linux-url: ${linuxZipUrl}" +echo "linux-sha256: ${linuxSha256}" + +rm -Rf homebrew-mvnd +git clone https://github.com/mvndaemon/homebrew-mvnd.git +cd homebrew-mvnd + +perl -i -0pe 's|(on_macos do\n\s+url )\"([^\"]+)\"(\n\s+sha256 )\"([^\"]+)\"|$1\"'${darwinZipUrl}'\"$3\"'${darwinSha256}'\"|g' Formula/mvnd.rb +perl -i -0pe 's|(on_linux do\n\s+url )\"([^\"]+)\"(\n\s+sha256 )\"([^\"]+)\"|$1\"'${linuxZipUrl}'\"$3\"'${linuxSha256}'\"|g' Formula/mvnd.rb +perl -i -0pe 's|(version )"([^\"]+)"|$1\"'${VERSION}'\"|g' Formula/mvnd.rb + +if [ -n "$(git status --porcelain)" ]; then + echo "Committing release ${VERSION}" + git config --global user.email "gnodet@gmail.com" + git config --global user.name "Guillaume Nodet" + git add -A + git commit -m "Release ${VERSION}" + git push origin master +else + echo "Nothing to commit" +fi + +popd \ No newline at end of file diff --git a/build/publish-on-sdkman.sh b/build/publish-on-sdkman.sh index fb9f4b0c..51d502f9 100755 --- a/build/publish-on-sdkman.sh +++ b/build/publish-on-sdkman.sh @@ -21,6 +21,12 @@ set -e VERSION=$1 +if [ "${VERSION}x" = "x" ] +then + echo "Specify the version: $0 [version]" + exit 1 +fi + echo "SDKMAN_CONSUMER_KEY: $(echo ${SDKMAN_CONSUMER_KEY} | cut -c-3)..." echo "SDKMAN_CONSUMER_TOKEN: $(echo ${SDKMAN_CONSUMER_TOKEN} | cut -c-3)..." @@ -31,8 +37,8 @@ function publishRelease() { SDKMAN_PLATFORM=$2 MVND_PLATFORM=$3 - FILE="mvnd-${VERSION}-${MVND_PLATFORM}.zip" - URL="https://github.com/apache/maven-mvnd/releases/download/${VERSION}/${FILE}" + FILE="maven-mvnd-${VERSION}-${MVND_PLATFORM}.zip" + URL="https://dist.apache.org/repos/dist/release/maven/mvnd/${VERSION}/${FILE}" RESPONSE="$(curl -s -X POST \ -H "Consumer-Key: ${SDKMAN_CONSUMER_KEY}" \ -H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \ @@ -75,7 +81,7 @@ node -pe " } " "${RESPONSE}" -RELEASE_URL=`curl -s -i https://git.io -F url=https://github.com/apache/maven-mvnd/releases/tag/${VERSION} | grep Location | sed -e 's/Location: //g' | tr -d '\n' | tr -d '\r'` +RELEASE_URL=`curl -s -i https://git.io -F url=https://dist.apache.org/repos/dist/release/maven/mvnd/${VERSION} | grep Location | sed -e 's/Location: //g' | tr -d '\n' | tr -d '\r'` echo "RELEASE_URL = $RELEASE_URL" RESPONSE="$(curl -s -X POST \ diff --git a/build/release.sh b/build/release-build.sh similarity index 100% rename from build/release.sh rename to build/release-build.sh diff --git a/build/publish.sh b/build/release-candidate.sh similarity index 100% rename from build/publish.sh rename to build/release-candidate.sh diff --git a/build/release-publish.sh b/build/release-publish.sh new file mode 100755 index 00000000..9cf7b677 --- /dev/null +++ b/build/release-publish.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# +# Copyright 2022 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +set -e +export VERSION=$1 + +if [ "${VERSION}x" = "x" ] +then + echo "Specify the version: $0 [version]" + exit 1 +fi + +svn move -m "Release Apache Maven Daemon ${VERSION}" \ + https://dist.apache.org/repos/dist/dev/maven/mvnd/${VERSION} \ + https://dist.apache.org/repos/dist/release/maven/mvnd/ + +./build/publish-on-homebrew.sh ${VERSION} +./build/publish-on-sdkman.sh ${VERSION} +# TODO: publish on macports +# TODO: publish on chocolatey +# TODO: publish on scoop + +popd \ No newline at end of file