Skip to content

Commit

Permalink
take advantage of the new tag support in circleci 2.0 for releasing o…
Browse files Browse the repository at this point in the history
…n tags (linkedin#60)
  • Loading branch information
radai-rosenblatt authored Sep 7, 2017
1 parent 9ec3dfb commit 35e6cac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- run:
command: ./gradlew assemble testJar
- run:
command: ./.circleci/publishOnCommitMsg.sh
command: ./.circleci/publish.sh

workflows:
version: 2
Expand All @@ -50,4 +50,6 @@ workflows:
- build
filters:
branches:
only: master
ignore: /.*/
tags:
only: /^RELEASE.*/
17 changes: 17 additions & 0 deletions .circleci/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

currentTag=`git describe --tags`
buildVersion=`grep -oP '^[\s]*version[\s]*=[\s]*\K([^\s]*)(?=([\s]*))' gradle.properties`

echo current tag is $currentTag, build version is $buildVersion

if [ "x$currentTag" != "xRELEASE-$buildVersion" ]; then
echo "current tag version does not match project version"
exit 1
fi

echo "Publishing a release"
#./gradlew distributeBuild

4 changes: 2 additions & 2 deletions .circleci/publishOnCommitMsg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

if git log -1 --pretty=%B | grep "^RELEASE.*";
then
echo "Publishing a release"
echo "Publishing a release on commit msg"
./gradlew distributeBuild
else
echo "Not a release"
echo "Not a release by commit msg"
fi

0 comments on commit 35e6cac

Please sign in to comment.