telegram-bot-bash/version

58 lines
1.3 KiB
Plaintext
Raw Normal View History

2019-04-01 16:24:05 +00:00
#!/bin/bash
#
2019-04-18 19:02:06 +00:00
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
2019-04-01 16:24:05 +00:00
# shellcheck disable=SC2016
#
# Easy Versioning in git:
#
# for setting your Version in git use e.g.:
# git tag -a v0.5 -m 'Version 0.5'
#
# Push tags upstream—this is not done by default:
# git push --tags
#
# # in case of a wrong tag remove it:
# git tag -d v0.5
#
# delete remote tag (eg, GitHub version)
# git push origin :refs/tags/v0.5
#
# Then use the describe command:
#
# git describe --tags --long
# This gives you a string of the format:
#
# v0.5-0-gdeadbee
# ^ ^ ^^
# | | ||
# | | |'-- SHA of HEAD (first seven chars)
# | | '-- "g" is for git
# | '---- number of commits since last tag
# |
# '--------- last tag
#
# run this script to (re)place Version number in files
#
unset IFS
# set -f # if you are paranoid use set -f to disable globbing
2019-04-01 16:24:05 +00:00
VERSION="$(git describe --tags --long)"
echo "Update files to version $VERSION ..."
2019-04-18 16:42:42 +00:00
FILES="* doc/* test/*"
[ "$1" != "" ] && FILES="$*"
for file in $FILES
do
[ ! -f "$file" ] && continue
#[ "$file" == "version" ] && continue
echo -n " $file"
2019-04-01 16:24:05 +00:00
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file"
done
# try to compile README.txt
2019-04-11 11:53:01 +00:00
echo -n " README.txt"
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
echo " done."