Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Add release script (#54)
Browse files Browse the repository at this point in the history
* Add release script

Release process:
1. Change version number in build.gradle
2. Execute ./release.sh

* bugfix

1. Fetch all tags from upstream first
2. Fix the case of the first rc version
  • Loading branch information
Junghyun Colin Kim authored and Brandon Lee committed Oct 22, 2019
1 parent 17f4f13 commit aff8374
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions find_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/local/bin/python
import re

with open("build.gradle", "r") as f:
l = f.read()
m = re.search("allprojects\s+{\s+version\s+(.*)\s", l)
versionString = m.group(1)
versionString = versionString[1:]
versionString = versionString[:-1]
print versionString
25 changes: 25 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Fetch tags from upstream first
git fetch -t git@github.com:klaytn/caver-java.git

VERSION=$(./find_version.py)
echo "Trying to tag v$VERSION"
git tag | grep "$VERSION\$"
if [ $? -eq 0 ]; then
echo "$VERSION is found in git tag!!! You should upgrade version number first!!!"
echo "Exiting..."
exit 1
fi

PREV_RCVERSION_FULL=`git tag | grep "$VERSION" | sort | tail -1`
RCSUFFIX="1"
if [ ! -z "$PREV_RCVERSION_FULL" ]; then
RCSUFFIX=$(echo "${PREV_RCVERSION_FULL##*.}"+1 | bc)
fi

RCVERSION="v$VERSION-rc.$RCSUFFIX"
echo "tagging $RCVERSION"

git tag $RCVERSION
git push upstream $RCVERSION

0 comments on commit aff8374

Please sign in to comment.