From b5dd43e5d2598da76d27ee7bded8daa74edeb323 Mon Sep 17 00:00:00 2001 From: Felipe Herranz Date: Sun, 3 Mar 2019 22:01:28 +0100 Subject: [PATCH 1/2] started release script --- release.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 release.sh diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..31dd42a --- /dev/null +++ b/release.sh @@ -0,0 +1,21 @@ +#!/bin/bash +#TODO: Update README.md + +while getopts v:m: OPTION; +do +case $OPTION + in + v) VERSION=$OPTARG;; + m) MESSAGE=$OPTARG;; +esac +done + +echo "Starting Release $VERSION with commit message $MESSAGE" + +VERSION_NAME="VERSION_NAME=$VERSION\n" + +ex -sc "1i|$VERSION_NAME" -cx gradle.properties +./gradlew clean build +git commit -am $MESSAGE +git tag -a $VERSION +git push && git push --tags \ No newline at end of file From 2487b609c5f1c5f85df68b063d2b61efa2b79ba5 Mon Sep 17 00:00:00 2001 From: Felipe Herranz Date: Sat, 9 Mar 2019 01:44:41 +0100 Subject: [PATCH 2/2] version of release script --- release.sh | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/release.sh b/release.sh index 31dd42a..9897e55 100644 --- a/release.sh +++ b/release.sh @@ -1,5 +1,8 @@ #!/bin/bash -#TODO: Update README.md +#Arguments: +# -v version eg 6.0.3 +# -m 6.0.3 +set -e while getopts v:m: OPTION; do @@ -10,12 +13,40 @@ case $OPTION esac done -echo "Starting Release $VERSION with commit message $MESSAGE" +# Show error message if no version was provided +if [ -z $VERSION ]; +then + echo "UsbSerial: Error!! No version was provided" + exit 0 +fi -VERSION_NAME="VERSION_NAME=$VERSION\n" +# Show error message if no message was provided +if [ -z $MESSAGE ]; +then + echo "UsbSerial: Error!! No message was provided" + exit 0 +fi +echo "UsbSerial: Starting Release $VERSION with commit message $MESSAGE" + +VERSION_NAME="VERSION_NAME=$VERSION" + +# Updating gradle.properties with version +ex -sc '1d|x' gradle.properties ex -sc "1i|$VERSION_NAME" -cx gradle.properties + +# Updating README file +GRADLE_LINE="implementation 'com.github.felHR85:UsbSerial:${VERSION}'" +LINE=$(cat README.md | grep -nr implementation\ \'com.github.felHR85:UsbSerial: | awk -F ":" '{print $2}') +ex -sc "${LINE}d|x" README.md +ex -sc "${LINE}i|$GRADLE_LINE" -cx README.md + +# Gradle clean and build ./gradlew clean build + +# Git stuff git commit -am $MESSAGE git tag -a $VERSION -git push && git push --tags \ No newline at end of file +git push && git push --tags + +echo "UsbSerial: Release Finished!!!" \ No newline at end of file