|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# get the second character of the version, so it can be incremented
|
|
|
|
#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"
|
|
|
|
|
|
|
|
prefix="tukethesis"
|
|
|
|
nextFil="$prefix-$nextTag"
|
|
|
|
remote="http://ktpe.fei.tuke.sk/vince/studenti/babic/index.php"
|
|
|
|
logFile="version.log"
|
|
|
|
|
|
|
|
echo "releasing version: $nextTag"
|
|
|
|
echo "----------------------"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# generate the log from git data
|
|
|
|
{
|
|
|
|
git diff --stat "$lastTag" HEAD | tail -1
|
|
|
|
echo ""
|
|
|
|
git log "$lastTag"..HEAD --pretty=oneline --abbrev-commit --reverse
|
|
|
|
} | tee "$nextFil.log"
|
|
|
|
|
|
|
|
# copy PDF output as a versioned file
|
|
|
|
cp "$prefix.pdf" "$nextFil.pdf"
|
|
|
|
|
|
|
|
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-$nextTag.log" "$remote"
|
|
|
|
curl -include --form "file=@tukethesis-$nextTag.pdf" "$remote"
|
|
|
|
} > "$logFile"
|
|
|
|
|
|
|
|
echo "Files were uploaded the remote host."
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# tag the version now and push it to the origin repo
|
|
|
|
git tag "$nextTag" -m "$tagMessage"
|
|
|
|
git push -u --tags origin master
|
|
|
|
|
|
|
|
# clear the files
|
|
|
|
rm *-"$nextTag".*
|
|
|
|
|