forked from m3g/packmol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·94 lines (70 loc) · 2.43 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
####################################################################################################
# Software name:
package=packmol
# HTML file containing download list:
downloads=/home/leandro/public_html/packmol/versionhistory/index.html
# GIT URL:
giturl=https://github.com/leandromartinez98/packmol
# Name of file containing version number
versionfile=./title.f90
####################################################################################################
#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"
file="$package-$version.tar.gz"
version_file=$version
i=2
while grep -q $file $downloads ; do
file=$package-$version.$i.tar.gz
version_file=$version.$i
i=`expr $i + 1`
done
version=$version_file
file=$package-$version.tar.gz
echo "Will create file: $file"
cat $versionfile | sed -e "s/Version.*/Version\ $version \')\")/" > version_title_temp.f90
\mv -f version_title_temp.f90 $versionfile
git add -A .
git commit -m "Changed version file to $version"
git tag -a $version -m "Release $version"
git push origin master tag $version
today=`date +"%b %d, %Y"`
changelog="https://github.com/leandromartinez98/$package/releases/tag/$version"
newline="<tr><td width=190px valign=top><a href=$giturl/archive/$version.tar.gz> $file </a></td><td> Released on $today - <a target=newpage href=$changelog> [change log at github] </a></td></tr>"
htmlfile=$downloads
echo "------------------------------"
echo "CREATING RELEASE IN HOME-PAGE:"
echo "------------------------------"
mkdir TEMP
cd TEMP
wget https://github.com/leandromartinez98/packmol/archive/$version.tar.gz
tar -xf $version.tar.gz
mv packmol-$version packmol
tar -cf packmol.tar ./packmol
gzip packmol.tar
scp packmol.tar.gz [email protected]:./public_html/packmol/
cd ..
\rm -rf ./TEMP
writeline=yes
while IFS= read -r line ; do
if [ "$writeline" = "yes" ] ; then
echo $line >> ./htmlfile_new_temp
fi
if [ $writeline = "no" ] ; then
writeline="yes"
fi
if [[ $line == *NEW_VERSION_HERE* ]] ; then
echo $newline >> ./htmlfile_new_temp
fi
done < "$htmlfile"
rm $htmlfile
mv htmlfile_new_temp $htmlfile
echo "----------------------"
echo "CHANGE LOG:"
echo "----------------------"
range=`git tag | tail -n 2 | xargs | sed 's! !...!'`
git log --pretty=oneline $range | awk '{$1=""; print "-"$0}'
echo "----------------------"
echo " Done. "