Update release scripts

This commit is contained in:
Guillaume Nodet
2023-03-31 15:59:56 +02:00
parent 538a5c1369
commit 60af0f0893
3 changed files with 41 additions and 17 deletions

View File

@@ -17,6 +17,7 @@
set -e set -e
export VERSION=$1 export VERSION=$1
export QUALIFIER=m39
if [ "${VERSION}x" = "x" ] if [ "${VERSION}x" = "x" ]
then then
@@ -28,15 +29,15 @@ rm -Rf target/releases/${VERSION}
mkdir -p target/releases/${VERSION} mkdir -p target/releases/${VERSION}
pushd target/releases pushd target/releases
darwinAmdZipUrl="https://downloads.apache.org/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-darwin-amd64.zip" darwinAmdZipUrl="https://downloads.apache.org/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-${QUALIFIER}-darwin-amd64.zip"
darwinAmdSha256="$(curl -L --silent "${darwinAmdZipUrl}.sha256")" darwinAmdSha256="$(curl -L --silent "${darwinAmdZipUrl}.sha256")"
darwinArmZipUrl="https://downloads.apache.org/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-darwin-aarch64.zip" darwinArmZipUrl="https://downloads.apache.org/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-${QUALIFIER}-darwin-aarch64.zip"
darwinArmSha256="$(curl -L --silent "${darwinArmZipUrl}.sha256")" darwinArmSha256="$(curl -L --silent "${darwinArmZipUrl}.sha256")"
linuxZipUrl="https://downloads.apache.org/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-linux-amd64.zip" linuxZipUrl="https://downloads.apache.org/maven/mvnd/${VERSION}/maven-mvnd-${VERSION}-${QUALIFIER}-linux-amd64.zip"
linuxSha256="$(curl -L --silent "${linuxZipUrl}.sha256")" linuxSha256="$(curl -L --silent "${linuxZipUrl}.sha256")"
echo "Updating Formula/mvnd.rb with" echo "Updating Formula/mvnd.rb with"
echo "version: ${VERSION}" echo "version: ${VERSION}-${QUALIFIER}"
echo "darwin-amd-url: ${darwinAmdZipUrl}" echo "darwin-amd-url: ${darwinAmdZipUrl}"
echo "darwin-amd-sha256: ${darwinAmdSha256}" echo "darwin-amd-sha256: ${darwinAmdSha256}"
echo "darwin-arm-url: ${darwinArmZipUrl}" echo "darwin-arm-url: ${darwinArmZipUrl}"
@@ -51,15 +52,15 @@ cd homebrew-mvnd
perl -i -0pe 's|(on_macos do[\s\S\n]+on_intel do\n\s+url )\"([^\"]+)\"(\n\s+sha256 )\"([^\"]+)\"|$1\"'${darwinAmdZipUrl}'\"$3\"'${darwinAmdSha256}'\"|g' Formula/mvnd.rb perl -i -0pe 's|(on_macos do[\s\S\n]+on_intel do\n\s+url )\"([^\"]+)\"(\n\s+sha256 )\"([^\"]+)\"|$1\"'${darwinAmdZipUrl}'\"$3\"'${darwinAmdSha256}'\"|g' Formula/mvnd.rb
perl -i -0pe 's|(on_macos do[\s\S\n]+on_arm do\n\s+url )\"([^\"]+)\"(\n\s+sha256 )\"([^\"]+)\"|$1\"'${darwinArmZipUrl}'\"$3\"'${darwinArmSha256}'\"|g' Formula/mvnd.rb perl -i -0pe 's|(on_macos do[\s\S\n]+on_arm do\n\s+url )\"([^\"]+)\"(\n\s+sha256 )\"([^\"]+)\"|$1\"'${darwinArmZipUrl}'\"$3\"'${darwinArmSha256}'\"|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|(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 perl -i -0pe 's|(version )"([^\"]+)"|$1\"'${VERSION}-${QUALIFIER}'\"|g' Formula/mvnd.rb
if [ -n "$(git status --porcelain)" ]; then if [ -n "$(git status --porcelain)" ]; then
echo "Committing release ${VERSION}" echo "Committing release ${VERSION}-${QUALIFIER}"
git config --global user.email "gnodet@gmail.com" git config --global user.email "gnodet@gmail.com"
git config --global user.name "Guillaume Nodet" git config --global user.name "Guillaume Nodet"
git add -A git add -A
git commit -m "Release ${VERSION}" git commit -m "Release ${VERSION}-${QUALIFIER}"
git push origin master #git push origin master
else else
echo "Nothing to commit" echo "Nothing to commit"
fi fi

View File

@@ -36,15 +36,16 @@ function publishRelease() {
VERSION=$1 VERSION=$1
SDKMAN_PLATFORM=$2 SDKMAN_PLATFORM=$2
MVND_PLATFORM=$3 MVND_PLATFORM=$3
QUALIFIER=$4
FILE="maven-mvnd-${VERSION}-${MVND_PLATFORM}.zip" FILE="maven-mvnd-${VERSION}-${QUALIFIER}-${MVND_PLATFORM}.zip"
URL="https://downloads.apache.org/maven/mvnd/${VERSION}/${FILE}" URL="https://downloads.apache.org/maven/mvnd/${VERSION}/${FILE}"
RESPONSE="$(curl -s -X POST \ RESPONSE="$(curl -s -X POST \
-H "Consumer-Key: ${SDKMAN_CONSUMER_KEY}" \ -H "Consumer-Key: ${SDKMAN_CONSUMER_KEY}" \
-H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \ -H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Accept: application/json" \ -H "Accept: application/json" \
-d '{"candidate": "mvnd", "version": "'${VERSION}'", "platform" : "'${SDKMAN_PLATFORM}'", "url": "'${URL}'"}' \ -d '{"candidate": "mvnd", "version": "'${VERSION}-${QUALIFIER}'", "platform" : "'${SDKMAN_PLATFORM}'", "url": "'${URL}'"}' \
https://vendors.sdkman.io/release)" https://vendors.sdkman.io/release)"
node -pe " node -pe "
@@ -58,10 +59,14 @@ function publishRelease() {
" "${RESPONSE}" " "${RESPONSE}"
} }
publishRelease ${VERSION} LINUX_64 linux-amd64 publishRelease ${VERSION} LINUX_64 linux-amd64 m39
publishRelease ${VERSION} MAC_OSX darwin-amd64 publishRelease ${VERSION} MAC_OSX darwin-amd64 m39
publishRelease ${VERSION} MAC_ARM64 darwin-aarch64 publishRelease ${VERSION} MAC_ARM64 darwin-aarch64 m39
publishRelease ${VERSION} WINDOWS_64 windows-amd64 publishRelease ${VERSION} WINDOWS_64 windows-amd64 m39
publishRelease ${VERSION} LINUX_64 linux-amd64 m40
publishRelease ${VERSION} MAC_OSX darwin-amd64 m40
publishRelease ${VERSION} MAC_ARM64 darwin-aarch64 m40
publishRelease ${VERSION} WINDOWS_64 windows-amd64 m40
echo "Setting ${VERSION} as a default" echo "Setting ${VERSION} as a default"
RESPONSE="$(curl -s -X PUT \ RESPONSE="$(curl -s -X PUT \
@@ -69,7 +74,7 @@ RESPONSE="$(curl -s -X PUT \
-H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \ -H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Accept: application/json" \ -H "Accept: application/json" \
-d '{"candidate": "mvnd", "version": "'${VERSION}'"}' \ -d '{"candidate": "mvnd", "version": "'${VERSION}-m39'"}' \
https://vendors.sdkman.io/default)" https://vendors.sdkman.io/default)"
node -pe " node -pe "
@@ -90,7 +95,25 @@ RESPONSE="$(curl -s -X POST \
-H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \ -H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Accept: application/json" \ -H "Accept: application/json" \
-d '{"candidate": "mvnd", "version": "'${VERSION}'", "url": "'${RELEASE_URL}'"}' \ -d '{"candidate": "mvnd", "version": "'${VERSION}-m39'", "url": "'${RELEASE_URL}'"}' \
https://vendors.sdkman.io/announce/struct)"
node -pe "
var json = JSON.parse(process.argv[1]);
if (json.status == 200 || json.status == 201) {
json.status + ' as expected from /announce/freeform';
} else {
console.log('Unexpected status from /announce/freeform: ' + process.argv[1]);
process.exit(1);
}
" "${RESPONSE}"
RESPONSE="$(curl -s -X POST \
-H "Consumer-Key: ${SDKMAN_CONSUMER_KEY}" \
-H "Consumer-Token: ${SDKMAN_CONSUMER_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"candidate": "mvnd", "version": "'${VERSION}-m40'", "url": "'${RELEASE_URL}'"}' \
https://vendors.sdkman.io/announce/struct)" https://vendors.sdkman.io/announce/struct)"
node -pe " node -pe "

View File

@@ -48,7 +48,7 @@ gh api $downloadUrl > artifacts-${VERSION}.zip
unzip artifacts-${VERSION}.zip -d ${VERSION} unzip artifacts-${VERSION}.zip -d ${VERSION}
cd ${VERSION} cd ${VERSION}
for dist in darwin-amd64.zip darwin-amd64.tar.gz darwin-aarch64.zip darwin-aarch64.tar.gz linux-amd64.zip linux-amd64.tar.gz windows-amd64.zip windows-amd64.tar.gz src.zip src.tar.gz for dist in m39-darwin-amd64.zip m39-darwin-amd64.tar.gz m39-darwin-aarch64.zip m39-darwin-aarch64.tar.gz m39-linux-amd64.zip m39-linux-amd64.tar.gz m39-windows-amd64.zip m39-windows-amd64.tar.gz m40-darwin-amd64.zip m40-darwin-amd64.tar.gz m40-darwin-aarch64.zip m40-darwin-aarch64.tar.gz m40-linux-amd64.zip m40-linux-amd64.tar.gz m40-windows-amd64.zip m40-windows-amd64.tar.gz src.zip src.tar.gz
do do
FILE=maven-mvnd-${VERSION}-${dist} FILE=maven-mvnd-${VERSION}-${dist}
shasum -a 256 -b ${FILE} | cut -d ' ' -f 1 > ${FILE}.sha256 shasum -a 256 -b ${FILE} | cut -d ' ' -f 1 > ${FILE}.sha256