-
Notifications
You must be signed in to change notification settings - Fork 52
/
release.sh
executable file
·59 lines (43 loc) · 1.5 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
####################################################################################################
#
# How to release the software:
#
# run ./release. 20.14.1 (for example)
#
# go to the github site and release the version corresponding to the new tag.
#
# Software name:
package=packmol
# Release version, read from command line:
version="$1"
# GIT URL:
giturl=https://github.com/m3g/packmol
# Name of files containing version number
versionfile=./src/title.f90
fpmfile=./fpm.toml
####################################################################################################
#git log --pretty=oneline 16.323...16.330 | awk '{$1=""; print "-"$0}'
year=`date +%y`
day=`date +%j`
#version="${year:0:1}${year:1:1}.$day"
if [[ $version < " " ]]; then
version=`grep version fpm.toml`
echo "ERROR: Please provide version number, with: ./release.sh 20.1.1"
echo " current $version"
exit
fi
cat $versionfile | sed -e "s/Version.*/Version\ $version \')\")/" > tmpfile.txt
\mv -f tmpfile.txt $versionfile
cat $fpmfile | sed -e "s/version.*/version = \"$version\"/" > tmpfile.txt
\mv -f tmpfile.txt $fpmfile
git add -A .
git commit -m "Changed version file to $version"
git tag -a "v$version" -m "Release $version"
git push origin master tag "v$version"
echo "----------------------"
echo "CHANGE LOG:"
echo "----------------------"
range=`git tag | sort -V | tail -n 2 | xargs | sed 's! !...!'`
git log --pretty=oneline $range | awk '{$1=""; print "-"$0}'
echo "----------------------"
echo " Done. "