forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbump.sh
40 lines (29 loc) · 1.28 KB
/
bump.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
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "usage: bump.sh <version>"
exit 1
fi
v=$1
if [[ $v == *"-" ]]; then
echo "Version must not end with -"
exit 1
fi
echo "echo ##teamcity[buildNumber '$v-%1']" > teamcity_set_version.cmd
if [[ $v == *"-"* ]]; then
# Prerelease version
without_prerelease=`echo $v | cut -d- -f1`
sed -i 's/^\(\s*\)"version": "[^"]*"/\1"version": "'$v'-*"/' src/Npgsql/project.json
sed -i 's/AssemblyVersion("[^"]*")/AssemblyVersion("'$without_prerelease'")/' src/CommonAssemblyInfo.cs
sed -i 's/AssemblyFileVersion("[^"]*")/AssemblyFileVersion("'$without_prerelease'")/' src/CommonAssemblyInfo.cs
sed -i 's/AssemblyInformationalVersion("[^"]*")/AssemblyInformationalVersion("'$v'")/' src/CommonAssemblyInfo.cs
else
# Release version
sed -i 's/^\(\s*\)"version": "[^"]*"/\1"version": "'$v'"/' src/Npgsql/project.json
sed -i 's/AssemblyVersion("[^"]*")/AssemblyVersion("'$v'")/' src/CommonAssemblyInfo.cs
sed -i 's/AssemblyFileVersion("[^"]*")/AssemblyFileVersion("'$v'")/' src/CommonAssemblyInfo.cs
sed -i 's/AssemblyInformationalVersion("[^"]*")/AssemblyInformationalVersion("'$v'")/' src/CommonAssemblyInfo.cs
fi
git add teamcity_set_version.cmd
git add src/Npgsql/project.json
git add src/CommonAssemblyInfo.cs
git commit -m "Bump version to $v"