forked from jellyfin/jellyfin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bump_version
executable file
·65 lines (53 loc) · 1.81 KB
/
bump_version
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
#!/usr/bin/env bash
# bump_version - increase the shared version and generate changelogs
set -o errexit
set -o pipefail
set -o xtrace
usage() {
echo -e "bump_version - increase the shared version"
echo -e ""
echo -e "Usage:"
echo -e " $ bump_version <new_version>"
}
if [[ -z $1 ]]; then
usage
exit 1
fi
shared_version_file="./SharedVersion.cs"
# csproj files for nuget packages
jellyfin_subprojects=(
MediaBrowser.Common/MediaBrowser.Common.csproj
Jellyfin.Data/Jellyfin.Data.csproj
MediaBrowser.Controller/MediaBrowser.Controller.csproj
MediaBrowser.Model/MediaBrowser.Model.csproj
Emby.Naming/Emby.Naming.csproj
src/Jellyfin.Extensions/Jellyfin.Extensions.csproj
)
issue_template_file="./.github/ISSUE_TEMPLATE/issue report.yml"
new_version="$1"
new_version_sed="$( cut -f1 -d'-' <<<"${new_version}" )"
old_version="$(
grep "AssemblyVersion" ${shared_version_file} \
| sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/'
)"
echo old assembly version: $old_version
# Set the assembly version to the specified new_version
sed -i "s|${old_version}|${new_version_sed}|g" ${shared_version_file}
# update nuget package version
for subproject in ${jellyfin_subprojects[@]}; do
echo ${subproject}
# Parse the version from the *.csproj file
old_version="$(
grep "VersionPrefix" ${subproject} \
| awk '{$1=$1};1' \
| sed -E 's/<VersionPrefix>([0-9\.]+[-a-z0-9]*)<\/VersionPrefix>/\1/'
)"
echo old nuget version: $old_version
# Set the nuget version to the specified new_version
sed -i "s|${old_version}|${new_version_sed}|g" ${subproject}
done
# Set the version in the GitHub issue template file
sed -i "s|${old_version}|${new_version_sed}|g" ${issue_template_file}
# Stage the changed files for commit
git add .
git status -v