Skip to content

Commit

Permalink
Merge pull request #8 from dartartem/master
Browse files Browse the repository at this point in the history
#6: Added deploying artifacts.
  • Loading branch information
cer authored Apr 23, 2020
2 parents 0d00b64 + 3446734 commit dc7b128
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ jobs:
path: ~/junit
- store_artifacts:
path: ~/container-logs
- run:
name: Publish artifacts
command: ./deploy-artifacts.sh
when: on_success
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,21 @@ subprojects {
eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } }
}

configurations {
deployerJars
}

dependencies {
deployerJars 'org.springframework.build:aws-maven:5.0.0.RELEASE'
}

uploadArchives {
repositories {
mavenDeployer {
repository(url: deployUrl)
configuration = configurations.deployerJars
repository(url: deployUrl) {
authentication(userName: System.getenv('S3_REPO_AWS_ACCESS_KEY'), password: System.getenv('S3_REPO_AWS_SECRET_ACCESS_KEY'))
}
pom.project {
licenses {
license {
Expand Down
33 changes: 33 additions & 0 deletions deploy-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/bash -e

BRANCH=$(git rev-parse --abbrev-ref HEAD)

if [ $BRANCH == "master" ] ; then
BUILD_SNAPSHOT=$(sed -e '/^version=/!d' -e 's/^version=\(.*\)-SNAPSHOT$/\1.BUILD-SNAPSHOT/' < gradle.properties)
echo master: publishing $BUILD_SNAPSHOT
./gradlew -P version=$BUILD_SNAPSHOT -P deployUrl=${S3_REPO_DEPLOY_URL} uploadArchives
exit 0
fi

if ! [[ $BRANCH =~ ^[0-9]+ ]] ; then
echo Not release $BRANCH - no PUSH
exit 0
elif [[ $BRANCH =~ RELEASE$ ]] ; then
BINTRAY_REPO_TYPE=release
elif [[ $BRANCH =~ M[0-9]+$ ]] ; then
BINTRAY_REPO_TYPE=milestone
elif [[ $BRANCH =~ RC[0-9]+$ ]] ; then
BINTRAY_REPO_TYPE=rc
else
echo cannot figure out bintray for this branch $BRANCH
exit -1
fi

echo BINTRAY_REPO_TYPE=${BINTRAY_REPO_TYPE}

VERSION=$BRANCH

$PREFIX ./gradlew -P version=${VERSION} \
-P bintrayRepoType=${BINTRAY_REPO_TYPE} \
-P deployUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-${BINTRAY_REPO_TYPE} \
testClasses bintrayUpload

0 comments on commit dc7b128

Please sign in to comment.