From 16cbf1188aa0f7d5616a4a6822e2128306ae0550 Mon Sep 17 00:00:00 2001 From: Serge Huber Date: Wed, 7 Dec 2022 14:07:39 +0100 Subject: [PATCH] UNOMI-721 Simplify release process (#550) - Add 2 stage scripts to simplify the release process to avoid mistakes and automate as much as possible. - Release guide will be updated in the website as well. --- release-stage-1.sh | 55 ++++++++++++++++++++++++++++++++++++++++ release-stage-2.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100755 release-stage-1.sh create mode 100755 release-stage-2.sh diff --git a/release-stage-1.sh b/release-stage-1.sh new file mode 100755 index 000000000..e35fd86bb --- /dev/null +++ b/release-stage-1.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +################################################################################ +if [ $# -eq 0 ] + then + echo "Please use arguments RELEASE_VERSION RELEASE_BRANCH. Ex: ./release-stage-1.sh 2.1.0 master" + exit 1 +fi +set -e +# keep track of the last executed command +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +# echo an error message before exiting +trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT +export RELEASE_VERSION=$1 +export RELEASE_BRANCH=$2 +echo Prepare staging 1 of release process for version $RELEASE_VERSION in branch $RELEASE_BRANCH... +mkdir -p target/release/$RELEASE_VERSION +pushd target/release/$RELEASE_VERSION +git clone https://gitbox.apache.org/repos/asf/unomi.git unomi-$RELEASE_VERSION +cd unomi-$RELEASE_VERSION +git checkout $RELEASE_BRANCH +mvn clean install -P apache-release,integration-tests,docker +mvn clean install -DskipITs=true -DskipTests=true -P integration-tests,rat,apache-release,docker,\!run-tests + +pushd target +gpg --verify unomi-root-$RELEASE_VERSION-SNAPSHOT-source-release.zip.asc unomi-root-$RELEASE_VERSION-SNAPSHOT-source-release.zip +shasum -a 512 unomi-root-$RELEASE_VERSION-SNAPSHOT-source-release.zip +cat unomi-root-$RELEASE_VERSION-SNAPSHOT-source-release.zip.sha512 +unzip unomi-root-$RELEASE_VERSION-SNAPSHOT-source-release.zip +cd unomi-root-$RELEASE_VERSION-SNAPSHOT +mvn clean install +popd + +mvn release:prepare -DskipITs=true -DskipTests=true -Drelease.arguments="-Papache-release,integration-tests,\!run-tests -DskipITs=true -DskipTests=true" -DdryRun=true -P apache-release,integration-tests,docker,\!run-tests +mvn deploy -DskipITs=true -DskipTests=true -Drelease.arguments="-Papache-release,integration-tests,\!run-tests -DskipITs=true -DskipTests=true" -P \!run-tests +rm release.properties +mvn -DskipITs=true -DskipTests=true -Drelease.arguments="-Papache-release,integration-tests,\!run-tests -DskipITs=true -DskipTests=true" -P apache-release,integration-tests,docker,\!run-tests release:prepare +mvn -DskipITs=true -DskipTests=true -Drelease.arguments="-Papache-release,integration-tests,\!run-tests -DskipITs=true -DskipTests=true" -P integration-tests,docker,\!run-tests release:perform +popd diff --git a/release-stage-2.sh b/release-stage-2.sh new file mode 100755 index 000000000..6cb9245b9 --- /dev/null +++ b/release-stage-2.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +################################################################################ +echo Prepare staging 2 of release process... +if [ $# -eq 0 ] + then + echo "Please use arguments RELEASE_VERSION NEXUS_REPOSITORY_ID. Ex: ./release-stage-2.sh 2.1.0 orgapacheunomi-1033" + exit 1 +fi +set -e +# keep track of the last executed command +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +# echo an error message before exiting +trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT + +export RELEASE_VERSION=$1 +export REPO_ID=$2 +pushd target/release/$RELEASE_VERSION +svn checkout https://dist.apache.org/repos/dist/dev/unomi unomi-dev +cd unomi-dev +mkdir $RELEASE_VERSION +cd $RELEASE_VERSION + +wget https://repository.apache.org/content/repositories/$REPO_ID/org/apache/unomi/unomi-root/$RELEASE_VERSION/unomi-root-$RELEASE_VERSION-source-release.zip +wget https://repository.apache.org/content/repositories/$REPO_ID/org/apache/unomi/unomi-root/$RELEASE_VERSION/unomi-root-$RELEASE_VERSION-source-release.zip.asc +wget https://repository.apache.org/content/repositories/$REPO_ID/org/apache/unomi/unomi/$RELEASE_VERSION/unomi-$RELEASE_VERSION.tar.gz +wget https://repository.apache.org/content/repositories/$REPO_ID/org/apache/unomi/unomi/$RELEASE_VERSION/unomi-$RELEASE_VERSION.tar.gz.asc +wget https://repository.apache.org/content/repositories/$REPO_ID/org/apache/unomi/unomi/$RELEASE_VERSION/unomi-$RELEASE_VERSION.zip +wget https://repository.apache.org/content/repositories/$REPO_ID/org/apache/unomi/unomi/$RELEASE_VERSION/unomi-$RELEASE_VERSION.zip.asc + +mv unomi-root-$RELEASE_VERSION-source-release.zip unomi-$RELEASE_VERSION-src.zip +mv unomi-root-$RELEASE_VERSION-source-release.zip.asc unomi-$RELEASE_VERSION-src.zip.asc +shasum -a 512 unomi-$RELEASE_VERSION-src.zip > unomi-$RELEASE_VERSION-src.zip.sha512 + +mv unomi-$RELEASE_VERSION.zip unomi-$RELEASE_VERSION-bin.zip +mv unomi-$RELEASE_VERSION.zip.asc unomi-$RELEASE_VERSION-bin.zip.asc +shasum -a 512 unomi-$RELEASE_VERSION-bin.zip > unomi-$RELEASE_VERSION-bin.zip.sha512 + +mv unomi-$RELEASE_VERSION.tar.gz unomi-$RELEASE_VERSION-bin.tar.gz +mv unomi-$RELEASE_VERSION.tar.gz.asc unomi-$RELEASE_VERSION-bin.tar.gz.asc +shasum -a 512 unomi-$RELEASE_VERSION-bin.tar.gz > unomi-$RELEASE_VERSION-bin.tar.gz.sha512 + +cd .. +svn add $RELEASE_VERSION + +svn commit -m "Apache $RELEASE_VERSION Release (for PMC voting)" +popd