Merge pull request #1246 from Alfresco/merge-2.7/APPS-241_addCoReleaseStage_merge2.7_no

APPS-241: Create Community and Enterprise Release and Publish Stages
This commit is contained in:
Elena Hardon
2020-10-22 14:08:05 +03:00
committed by ehardon
parent 5465a39576
commit 3f534aaaad
8 changed files with 179 additions and 14 deletions

View File

@@ -35,7 +35,9 @@ stages:
if: commit_message !~ /\[skip tests\]/
- name: Security Scans
- name: Release
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message =~ /\[(community|enterprise) release .*\]/
- name: Publish
if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message =~ /\[publish\]/
jobs:
include:
@@ -110,16 +112,92 @@ jobs:
script:
- echo "Static Analysis (SAST)"
- name: "Community Release"
- name: "Community Release and Publish to S3 Staging Bucket"
stage: Release
if: commit_message =~ /\[community release .*\]/
before_script:
- source scripts/set-release-variables.sh
script:
- echo "Community Release"
- name: "Enterprise Release"
stage: Release
script:
- echo "Enterprise Release"
- bash scripts/release.sh "community"
before_deploy:
- bash scripts/zip-artifacts-staging.sh "community"
deploy:
- provider: s3
access_key_id: ${STAGING_AWS_ACCESS_KEY}
secret_access_key: ${STAGING_AWS_SECRET_KEY}
region: "eu-west-1"
bucket: "alfresco-artefacts-staging"
upload_dir: "community/RM/${RELEASE_VERSION}"
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/RM/${RELEASE_VERSION}"
- name: "Copy to S3 Release Bucket"
stage: Publish
- name: "Enterprise Release and Publish to S3 Staging Bucket"
stage: Release
if: commit_message =~ /\[enterprise release .*\]/
before_script:
- source scripts/set-release-variables.sh
script:
- echo "Copy to S3 Release Bucket"
- bash scripts/release.sh "enterprise"
before_deploy:
- bash scripts/zip-artifacts-staging.sh "enterprise"
deploy:
- provider: s3
access_key_id: ${STAGING_AWS_ACCESS_KEY}
secret_access_key: ${STAGING_AWS_SECRET_KEY}
region: "eu-west-1"
bucket: "alfresco-artefacts-staging"
upload_dir: "enterprise/RM/${RELEASE_VERSION}"
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/enterprise/RM/${RELEASE_VERSION}"
- name: "Community Publish to S3 Release Bucket"
stage: Publish
if: commit_message =~ /\[community release .*\]/ AND commit_message =~ /\[publish\]/
before_script: source scripts/set-release-variables.sh
script: skip
before_deploy: bash scripts/zip-artifacts-release.sh "community"
deploy:
- provider: s3
access_key_id: ${RELEASE_AWS_ACCESS_KEY}
secret_access_key: $RELEASE_AWS_ACCESS_SECRET}
region: "eu-west-1"
bucket: "eu.dl.alfresco.com"
upload_dir: "release/community/RM/${RELEASE_VERSION}"
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/eu.dl.alfresco.com/release/community/RM/${RELEASE_VERSION}"
- name: "Enterprise Publish to S3 Release Bucket"
stage: Publish
if: commit_message =~ /\[enterprise release .*\]/ AND commit_message =~ /\[publish\]/
before_script: source scripts/set-release-variables.sh
script: skip
before_deploy: bash scripts/zip-artifacts-release.sh "enterprise"
deploy:
- provider: s3
access_key_id: ${RELEASE_AWS_ACCESS_KEY}
secret_access_key: ${RELEASE_AWS_ACCESS_SECRET}
region: "eu-west-1"
bucket: "eu.dl.alfresco.com"
upload_dir: "release/enterprise/RM/${RELEASE_VERSION}"
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/eu.dl.alfresco.com/release/enterprise/RM/${RELEASE_VERSION}"

View File

@@ -138,3 +138,4 @@ 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

View File

@@ -21,9 +21,9 @@
</organization>
<scm>
<connection>scm:git:ssh://git@github.com/Alfresco/governance-services.git</connection>
<developerConnection>scm:git:ssh://git@github.com/Alfresco/governance-services.git</developerConnection>
<url>scm:git:ssh://git@github.com/Alfresco/governance-services.git</url>
<connection>scm:git:https://github.com/Alfresco/governance-services.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/governance-services.git</developerConnection>
<url>https://github.com/Alfresco/governance-services</url>
<tag>HEAD</tag>
</scm>

32
scripts/release.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
# Use full history for release
git checkout -B "${TRAVIS_BRANCH}"
git config user.email "build@alfresco.com"
release_type=$1
echo Release type: "$release_type"
if [ -z $release_type ]; then
echo "Please provide a release type."
exit 1
elif [ $release_type != "community" -a $release_type != "enterprise" ]; then
echo "The provided release type is not valid."
exit 1
fi
if [ -z ${RELEASE_VERSION} ] || [ -z ${DEVELOPMENT_VERSION} ]; then
echo "Please provide a Release and Development verison"
exit 1
fi
mvn --batch-mode \
-Dusername="${GIT_USERNAME}" \
-Dpassword="${GIT_PASSWORD}" \
-DreleaseVersion=${RELEASE_VERSION} \
-DdevelopmentVersion=${DEVELOPMENT_VERSION} \
-DscmCommentPrefix="[maven-release-plugin][skip ci] " \
-DskipTests -D${release_type} -DuseReleaseProfile=false \
-P${release_type}-release release:clean release:prepare release:perform

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
echo "Travis commit message: $TRAVIS_COMMIT_MESSAGE"
release_message=$(echo $TRAVIS_COMMIT_MESSAGE | grep -Po '(\[(community|enterprise)\srelease\s(\d\.)+(\d|[a-z])(-[A-Z]\d){0,1}\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 1
fi
export RELEASE_VERSION=$(echo $release_message | grep -Po '(\d\.)+(\d|[a-z])(-[A-Z]\d){0,1}' | head -1)
export DEVELOPMENT_VERSION=$(echo $release_message | grep -Po '(\d\.)+\d-SNAPSHOT')
echo "Release version is set to $RELEASE_VERSION"
echo "Development version is set to $DEVELOPMENT_VERSION"

View File

@@ -7,5 +7,4 @@ then
export MAVEN_PHASE="deploy"
else
export MAVEN_PHASE="verify"
fi
fi

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
release_type=$1
mkdir "artifacts_dir"
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy \
-Dartifact=org.alfresco:alfresco-rm-${release_type}-repo:${RELEASE_VERSION}:amp \
-DoutputDirectory=artifacts_dir
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy \
-Dartifact=org.alfresco:alfresco-rm-${release_type}-share:${RELEASE_VERSION}:amp \
-DoutputDirectory=artifacts_dir
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy \
-Dartifact=org.alfresco:alfresco-rm-${release_type}-rest-api-explorer:${RELEASE_VERSION}:war \
-DoutputDirectory=artifacts_dir
cd artifacts_dir
zip alfresco-rm-${release_type}-${RELEASE_VERSION}.zip *
# rm *.amp *.war -f
ls

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
release_type=$1
mkdir "artifacts_dir"
cp rm-${release_type}/rm-${release_type}-repo/target/alfresco-rm-${release_type}-repo-*.amp artifacts_dir
cp rm-${release_type}/rm-${release_type}-share/target/alfresco-rm-${release_type}-share-*.amp artifacts_dir
cp rm-${release_type}/rm-${release_type}-rest-api-explorer/target/alfresco-rm-${release_type}-rest-api-explorer-*.war artifacts_dir
cd artifacts_dir
zip alfresco-rm-${release_type}-${RELEASE_VERSION}.zip *
# rm *.amp *.war -f
ls