From d42e5854a375969459f16a60f344e8ff788bc564 Mon Sep 17 00:00:00 2001 From: ehardon Date: Wed, 7 Oct 2020 16:02:26 +0300 Subject: [PATCH] APPS-241: - address PR comments - extract release version and development version from commit message --- .travis.yml | 4 ---- README.md | 9 +++++++++ scripts/release-community.sh | 6 +----- scripts/set-release-variables.sh | 30 ++++++++++++++++++------------ scripts/zip-artifacts.sh | 4 ++-- travis-env-vars.yml | 2 ++ 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc7642ef01..a8567cb0e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,10 +27,6 @@ install: skip services: - docker -env: - global: - - RELEASE_VERSION=2.7.3 - - DEVELOPMENT_VERSION=2.7.3-SNAPSHOT stages: - name: Build AGS diff --git a/README.md b/README.md index 2fc454a51f..adf944d8bc 100644 --- a/README.md +++ b/README.md @@ -138,3 +138,12 @@ Unzip it and change to the "solr" folder within it. Start the Solr server using solr start -a "-Dcreate.alfresco.defaults=alfresco,archive" ``` Start your repository + +## Release process + +In order to release a new community or enterprise version you need to: +* make sure you are either on a release branch or on master branch +* push a new commit message containing the following [$release_type release $release_version $development_version] where + * release_type should contain one of the following: *internal community*/*internal enterprise* -> for internal releases or _community_/_enterprise_ + * release_version must contain the desired release version + * development_version must contain the next development version \ No newline at end of file diff --git a/scripts/release-community.sh b/scripts/release-community.sh index 6a5f0ed88e..3627c63cf8 100644 --- a/scripts/release-community.sh +++ b/scripts/release-community.sh @@ -1,16 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash set -e -GIT_COMMITTER_NAME=alfresco-build -GIT_COMMITTER_EMAIL=info@alfresco.com - # Use full history for release git checkout -B "${TRAVIS_BRANCH}" # Add email to link commits to user git config user.email "${GIT_COMMITTER_EMAIL}" git config user.name "${GIT_COMMITTER_NAME}" - if [ -z ${RELEASE_VERSION} ] || [ -z ${DEVELOPMENT_VERSION} ]; then echo "Please provide a Release and Development verison" exit -1 diff --git a/scripts/set-release-variables.sh b/scripts/set-release-variables.sh index 5cfb357fba..a21b74de9d 100755 --- a/scripts/set-release-variables.sh +++ b/scripts/set-release-variables.sh @@ -1,34 +1,40 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash -# TODO: check if the message is in the right format eg [internal community release 3.4.0 3.4.0-SNAPSHOT] +release_message=$(echo $TRAVIS_COMMIT_MESSAGE | ggrep -Po '\[(internal )*(community|enterprise)\srelease\s(\d\.)+(\d|[a-z])\s(\d\.)+\d-SNAPSHOT\]') +if [ ! -n "$release_message" ]; then + echo "The commit message is in the wrong format or it does not contain all the required properties." + exit 0 +fi -export RELEASE_VERSION=$(echo $TRAVIS_COMMIT_MESSAGE | grep -Po '(\d\.)+\d ') -export DEVELOPMENT_VERSION=$(echo $TRAVIS_COMMIT_MESSAGE | grep -Po '(\d\.)+\d-SNAPSHOT') +export RELEASE_VERSION=$(echo $release_message | ggrep -Po '\g<1>(\d\.)+(\d|[a-z])') +export DEVELOPMENT_VERSION=$(echo $release_message | ggrep -Po '(\d\.)+\d-SNAPSHOT') -export release_type=$(echo $TRAVIS_COMMIT_MESSAGE | grep -Po 'internal (community|enterprise)') +echo "Release version is set to $RELEASE_VERSION" +echo "Development version is set to $DEVELOPMENT_VERSION" + +release_type=$(echo $release_message | ggrep -Po '(internal\s)*(community|enterprise)') if [[ $release_type =~ "community" ]]; then - echo "Setting Community release variables..." + echo "Setting Community Release variables..." if [[ $release_type =~ "internal" ]]; then echo "Setting ARTIFACTS_UPLOAD_BUCKET and ARTIFACTS_UPLOAD_DIR for the Internal release" export ARTIFACTS_UPLOAD_BUCKET="alfresco-artefacts-staging" export ARTIFACTS_UPLOAD_DIR="community/alfresco-governance-services/release/${TRAVIS_BRANCH}" else echo "Setting ARTIFACTS_UPLOAD_BUCKET and ARTIFACTS_UPLOAD_DIR for the release" -# export ARTIFACTS_UPLOAD_BUCKET="alfresco-artefacts-staging" -> -# export ARTIFACTS_UPLOAD_DIR="community/alfresco-governance-services/release/${TRAVIS_BRANCH}" + export ARTIFACTS_UPLOAD_BUCKET="eu.dl.alfresco.com" + export ARTIFACTS_UPLOAD_DIR="release/community/RM/${RELEASE_VERSION}" fi elif [[ $release_type =~ "enterprise" ]]; then - echo "Setting Enterprise release variables..." + echo "Setting Enterprise Release variables..." if [[ $release_type =~ "internal" ]]; then echo "Setting ARTIFACTS_UPLOAD_BUCKET and ARTIFACTS_UPLOAD_DIR for the Internal release" export ARTIFACTS_UPLOAD_BUCKET="alfresco-artefacts-staging" export ARTIFACTS_UPLOAD_DIR="enterprise/alfresco-governance-services/release/${TRAVIS_BRANCH}" else echo "Setting ARTIFACTS_UPLOAD_BUCKET and ARTIFACTS_UPLOAD_DIR for the release" -# export ARTIFACTS_UPLOAD_BUCKET="alfresco-artefacts-staging" -> -# export ARTIFACTS_UPLOAD_DIR="enterprise/alfresco-governance-services/release/${TRAVIS_BRANCH}" + export ARTIFACTS_UPLOAD_BUCKET="eu.dl.alfresco.com" + export ARTIFACTS_UPLOAD_DIR="release/enterprise/RM/${RELEASE_VERSION}" fi fi \ No newline at end of file diff --git a/scripts/zip-artifacts.sh b/scripts/zip-artifacts.sh index 506262140b..50154690a6 100644 --- a/scripts/zip-artifacts.sh +++ b/scripts/zip-artifacts.sh @@ -1,12 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash set -e if [ $1 == 'community' ]; then mkdir "artifacts_dir" cp rm-community/rm-community-repo/target/alfresco-rm-*community*amp artifacts_dir cp rm-community/rm-community-share/target/alfresco-rm-*community*amp artifacts_dir + cd artifacts_dir zip alfresco-rm-community-${RELEASE_VERSION}.zip *amp - cp alfresco-rm-community-${RELEASE_VERSION}.zip artifacts_dir ls artifacts_dir #elif [ $1 == "enterprise" ]; then fi diff --git a/travis-env-vars.yml b/travis-env-vars.yml index cb6c4b75d6..fdb8385892 100644 --- a/travis-env-vars.yml +++ b/travis-env-vars.yml @@ -4,3 +4,5 @@ env: - AUTOMATION_ENTERPRISE_PATH=rm-automation/rm-automation-enterprise-rest-api - AUTOMATION_UI_PATH=rm-automation/rm-automation-ui - S3_INSTALLER_PATH=/eu.dl.alfresco.com/release/enterprise/5.2/5.2.7/5.2.7.4/alfresco-content-services-installer-5.2.7.4-linux-x64.bin + - GIT_COMMITTER_NAME=alfresco-build + - GIT_COMMITTER_EMAIL=info@alfresco.com \ No newline at end of file