-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
executable file
·35 lines (30 loc) · 952 Bytes
/
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
#!/bin/bash
PROJECT="$(basename "$(pwd)")"
CHANGELOG="Changelog.txt"
ver=$1
short=$1
while [ "$(echo "$ver" | tr -dc '.' | awk '{ print length; }')" -lt "3" ]
do
ver="${ver}.0"
done
sed -i 's/AssemblyVersion(.*)/AssemblyVersion("'$ver'")/' $PROJECT/Properties/AssemblyInfo.cs
sed -i 's/AssemblyFileVersion(.*)/AssemblyFileVersion("'$ver'")/' $PROJECT/Properties/AssemblyInfo.cs
sed -i 's/"version": ".*",/"version": "v'$short'",/' $PROJECT/manifest.json
mv "$CHANGELOG"{,.old}
echo "v${short}" > "$CHANGELOG"
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:' %s' >> "$CHANGELOG"
echo -e "\n" >> "$CHANGELOG"
cat "$CHANGELOG".old >> "$CHANGELOG"
$EDITOR "$CHANGELOG"
_status=$?
if [[ $_status != 0 ]]; then
echo "Aborting..."
rm "$CHANGELOG"
mv "$CHANGELOG"{.old,}
exit
fi
rm "$CHANGELOG".old
git add $PROJECT/Properties/AssemblyInfo.cs $PROJECT/manifest.json "$CHANGELOG"
git commit -m "v${short}"
git tag "v${short}"
msbuild