Skip to content

Instantly share code, notes, and snippets.

@giovannicandido
Created June 20, 2019 13:52
Show Gist options
  • Save giovannicandido/7f316eaefe16f6dcbd98c4b919cbb4cd to your computer and use it in GitHub Desktop.
Save giovannicandido/7f316eaefe16f6dcbd98c4b919cbb4cd to your computer and use it in GitHub Desktop.
#!/bin/bash
CURRENT_VERSION=`cat ./gradle.properties | grep ^version= | cut -d= -f2`
echo "Current version $CURRENT_VERSION"
CURRENT_BUILD=`echo $CURRENT_VERSION | cut -d. -f4 | cut -d- -f2`
NEXT_BUILD=$((CURRENT_BUILD+1))
MAJOR=`echo $CURRENT_VERSION | cut -d. -f1`
MINOR=`echo $CURRENT_VERSION | cut -d. -f2`
FIX=`echo $CURRENT_VERSION | cut -d. -f3`
NEW_VERSION=$MAJOR.$MINOR.$FIX.build-$NEXT_BUILD
echo "publishing new version $CURRENT_VERSION"
./gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=$CURRENT_VERSION -Prelease.newVersion=$NEW_VERSION
echo "next version will be $NEW_VERSION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment