diff --git a/.travis.yml b/.travis.yml index 006a9da762..bc7642ef01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,7 +115,9 @@ jobs: - name: "Community Release" stage: Release - if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message =~ /\[community release\]/ + if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message =~ /\[.*release .*\]/ + before_script: + bash scripts/set-release-variables.sh script: - echo "Community Release" - bash scripts/release-community.sh @@ -126,15 +128,16 @@ jobs: access_key_id: ${ARTIFACTS_KEY} secret_access_key: ${ARTIFACTS_SECRET} region: "eu-west-1" - bucket: "alfresco-artefacts-staging" - upload_dir: "community/alfresco-governance-services/release/${TRAVIS_BRANCH}" + bucket: ${ARTIFACTS_UPLOAD_BUCKET} + upload_dir: ${ARTIFACTS_UPLOAD_DIR} skip_cleanup: true acl: private local_dir: artifacts_dir on: all_branches: true after_deploy: - - echo "Finished release and deployed to https://s3.console.aws.amazon.com/s3/buckets/alfresco-artefacts-staging/community/alfresco-governance-services/release/${TRAVIS_BRANCH}" + - echo "Finished release and deployed to https://s3.console.aws.amazon.com/s3/buckets/${ARTIFACTS_UPLOAD_BUCKET}/${ARTIFACTS_UPLOAD_DIR}" + - name: "Enterprise Release" stage: Release diff --git a/scripts/set-release-variables.sh b/scripts/set-release-variables.sh new file mode 100755 index 0000000000..5cfb357fba --- /dev/null +++ b/scripts/set-release-variables.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e + +# TODO: check if the message is in the right format eg [internal community release 3.4.0 3.4.0-SNAPSHOT] + + +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_type=$(echo $TRAVIS_COMMIT_MESSAGE | grep -Po 'internal (community|enterprise)') + +if [[ $release_type =~ "community" ]]; then + 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}" + fi +elif [[ $release_type =~ "enterprise" ]]; then + 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}" + fi +fi \ No newline at end of file