-
Notifications
You must be signed in to change notification settings - Fork 14
/
deploy.sh
47 lines (44 loc) · 1.95 KB
/
deploy.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
#!/bin/bash
#This script sets assembly infos and builds csv-compare and zips it in a properly named tar archive
# stop on errors
set -e
#Variables
root="`dirname \"$0\"`"
output=$root"/Modelica_ResultCompare/Properties/AssemblyInfo.cs"
version=$(git describe --tags)
fileversion=$(echo $version | sed 's/v\(\([0-9]\(\.\)\?\)\{3\}\).*/\1/g')
dt=$(date +%Y)
# check for template
if [ -e $input ]
then
echo found $input
sed -i 's/\(Assembly\)\(.*\)\(Version\)(.*/\1\2\3("'$fileversion'")]/' $output
echo file version set to $fileversion
sed -i 's/\(AssemblyInformationalVersionAttribute\)(.*/\1("'$version'")]/' $output
echo informational version set to $version
sed -i 's/\(AssemblyCopyright\).*/AssemblyCopyright("Copyright © '$dt' ESI ITI GmbH and contributors")]/' $output
else
echo "No template found @"$input!
exit 1
fi
# get shell
if [[ $(uname -s) == MINGW32* ]]
then
echo running cmd //c $root/"winbuild.bat"
cmd //c "winbuild.bat"
# create zip file
zipper="/c/Program Files/7-Zip/7z.exe"
"$zipper" a -tzip $root/csv-compare.windows-$version.x64.zip ./Modelica_ResultCompare/bin/x64/Release/Compare.exe BUILD.md LICENSE README.md RELEASENOTES.md ./Third-party
echo "Successfully created the file $root/csv-compare.windows-$version.x64.tar.gz"
"$zipper" a -tzip $root/csv-compare.windows-$version.x86.zip ./Modelica_ResultCompare/bin/x86/Release/Compare.exe BUILD.md LICENSE README.md RELEASENOTES.md ./Third-party
echo "Successfully created the file $root/csv-compare.windows-$version.x86.tar.gz"
else
# build release
make release
# create zip file
tar -czf $root/csv-compare.linux-$version.tar.gz Modelica_ResultCompare/bin/Release/Compare.exe BUILD.md LICENSE README.md RELEASENOTES.md ./Third-party
echo "Successfully created the file csv-compare.linux-$version.tar.gz with the following content:"
tar tf $root/csv-compare.linux-$version.tar.gz
fi
echo "resetting AssemblyInfo.cs"
git checkout -- $output