automatic version upload script improved

master
Peter Babič 9 years ago
parent 5ca2c19040
commit ac352ef1bb
  1. 28
      version.sh

@ -1,7 +1,8 @@
#!/bin/bash
# get the second character of the version, so it can be incremented
lastTag=$(git describe --abbrev=0 --tags)
#lastTag=$(git describe --abbrev=0 --tags)
lastTag=$(git describe --tags `git rev-list --tags --max-count=1`)
lastNum=${lastTag:1:1}
nextNum=$((lastNum + 1))
nextTag="v$nextNum"
@ -11,9 +12,9 @@ nextFil="$prefix-$nextTag"
remote="http://ktpe.fei.tuke.sk/vince/studenti/babic/index.php"
logFile="version.log"
#echo "releasing version: $nextTag"
#echo "----------------------"
#echo ""
echo "releasing version: $nextTag"
echo "----------------------"
echo ""
# generate the log from git data
{
@ -29,19 +30,22 @@ echo ""
echo "-------------------------------------------"
echo ""
echo "Input short message describing the changes (tag message):"
read tagMessage
# upload the new version of PDF and a log to the Mr.Vince's remote server
{
curl -include --form "file=@tukethesis-v3.log" "$remote"
curl -include --form "file=@tukethesis-v3.pdf" "$remote"
curl -include --form "file=@tukethesis-$nextTag.log" "$remote"
curl -include --form "file=@tukethesis-$nextTag.pdf" "$remote"
} > "$logFile"
#echo "Files uploaded to remote host."
#echo ""
# clear the files
rm *-"$nextTag".*
echo "Files were uploaded the remote host."
echo ""
# tag the version now and push it to the origin repo
git tag "$nextTag" -m "$@"
git tag "$nextTag" -m "$tagMessage"
git push -u --tags origin master
# clear the files
rm *-"$nextTag".*

Loading…
Cancel
Save