UsbSerial/release.sh

55 wiersze
1.2 KiB
Bash
Czysty Zwykły widok Historia

2019-03-03 21:01:28 +00:00
#!/bin/bash
2019-03-09 00:44:41 +00:00
#Arguments:
# -v version eg 6.0.3
# -m 6.0.3
set -e
2019-03-03 21:01:28 +00:00
while getopts v:m: OPTION;
do
case $OPTION
in
v) VERSION=$OPTARG;;
m) MESSAGE=$OPTARG;;
esac
done
2019-03-09 00:44:41 +00:00
# Show error message if no version was provided
2019-03-09 20:46:15 +00:00
if [[ -z ${VERSION} ]];
2019-03-09 00:44:41 +00:00
then
echo "UsbSerial: Error!! No version was provided"
exit 0
fi
2019-03-03 21:01:28 +00:00
2019-03-09 00:44:41 +00:00
# Show error message if no message was provided
2019-03-09 20:46:15 +00:00
if [[ -z ${MESSAGE} ]];
2019-03-09 00:44:41 +00:00
then
echo "UsbSerial: Error!! No message was provided"
exit 0
fi
2019-03-03 21:01:28 +00:00
2019-03-09 00:44:41 +00:00
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
2019-03-03 21:01:28 +00:00
ex -sc "1i|$VERSION_NAME" -cx gradle.properties
2019-03-09 00:44:41 +00:00
# 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
2019-03-03 21:01:28 +00:00
./gradlew clean build
2019-03-09 00:44:41 +00:00
# Git stuff
2019-03-09 20:46:15 +00:00
git add .
git commit -m "${MESSAGE}"
git tag ${VERSION}
2019-03-09 20:27:34 +00:00
git push origin master
git push --tags
2019-03-09 00:44:41 +00:00
2021-06-15 03:09:38 +00:00
echo "UsbSerial: Release Finished!!!"