-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
250b651
commit 0c85b7b
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exo pipefail | ||
|
||
# Gets a property out of a .properties file | ||
# usage: getProperty $key $filename | ||
function getProperty() { | ||
grep "${1}" "$2" | cut -d'=' -f2 | ||
} | ||
|
||
NEW_VERSION=$1 | ||
NEW_SNAPSHOT_VERSION=$2 | ||
CUR_SNAPSHOT_VERSION=$(getProperty 'VERSION_NAME' gradle.properties) | ||
|
||
if [ -z "$NEW_SNAPSHOT_VERSION" ]; then | ||
# If no snapshot version was provided, use the current value | ||
NEW_SNAPSHOT_VERSION=$CUR_SNAPSHOT_VERSION | ||
fi | ||
|
||
echo "Publishing $NEW_VERSION" | ||
|
||
# Prepare release | ||
sed -i.bak "s/${CUR_SNAPSHOT_VERSION}/${NEW_VERSION}/g" gradle.properties | ||
git add gradle.properties | ||
git commit -m "Prepare for release $NEW_VERSION" | ||
|
||
# Build | ||
./gradlew build | ||
|
||
# Add git tag | ||
git tag "v$NEW_VERSION" | ||
# Prepare next snapshot | ||
echo "Setting next snapshot version $NEW_SNAPSHOT_VERSION" | ||
sed -i.bak "s/${NEW_VERSION}/${NEW_SNAPSHOT_VERSION}/g" gradle.properties | ||
git add gradle.properties | ||
git commit -m "Prepare next development version" | ||
|
||
# Remove the backup file from sed edits | ||
rm gradle.properties.bak | ||
|
||
# Push it all up | ||
#git push && git push --tags |