-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdotnet-bump
More file actions
executable file
·95 lines (86 loc) · 2.91 KB
/
dotnet-bump
File metadata and controls
executable file
·95 lines (86 loc) · 2.91 KB
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
94
95
#!/bin/bash
set -e -u -x
cd "$(dirname "$0")"
function echo_version {
local version=$1
echo "sdk_version=$version"
version_prefix=$(echo "$version" | cut -d- -f1)
echo "sdk_version_prefix=$version_prefix"
version_suffix=$(echo "$version" | cut -d- -f2- -s)
echo "sdk_version_suffix=$version_suffix"
major_version=$(echo "$version_prefix" | cut -d. -f1)
echo "sdk_major_version=$major_version"
minor_version=$(echo "$version_prefix" | cut -d. -f2)
echo "sdk_minor_version=$minor_version"
if [ -n "$version_suffix" ]; then
short_date=$(echo "$version_suffix" | cut -d- -f2)
if [ "$short_date" == "$version_suffix" ]; then
short_date=$(echo "$version_suffix" | rev | cut -d. -f2 | rev)
revision=$(echo "$version_suffix" | rev | cut -d. -f1 | rev)
else
revision=$(echo "$version_suffix" | cut -d- -f3)
fi
#Subtracting 100 from the revision number to match the offical build id format of Microsoft.(added during the build process automatically)
revision=$((revision - 100))
yy=$((short_date / 1000))
mm=$(((short_date - 1000 * yy) / 50))
dd=$((short_date - 1000 * yy - 50 * mm))
echo -n "OFFICIAL_BUILD_ID="
printf "20%02d%02d%02d.%s\n" "$yy" "$mm" "$dd" "$revision"
else
echo "OFFICIAL_BUILD_ID="
fi
}
platform=11.0.1xx
while [ $# -gt 0 ]; do
case "$1" in
--platform)
shift
platform=$1
;;
*)
break
;;
esac
shift
done
if [ $# -gt 0 ]; then
sdk_version=$1
shift
fi
git submodule update --init --recursive
if [[ -z "${sdk_version+x}" ]]; then
url="https://aka.ms/dotnet/$platform/daily/productCommit-linux-x64.txt"
else
url="https://builds.dotnet.microsoft.com/dotnet/Sdk/$sdk_version/productCommit-linux-x64.txt"
if ! curl --head --silent --fail "$url" >/dev/null; then
url="https://ci.dot.net/public/Sdk/$sdk_version/productCommit-linux-x64.txt"
fi
fi
manifest=$(curl -L "$url")
pushd dotnet
if [[ "$manifest" =~ sdk:([0-9a-f]+),\ ([^[:space:]]+) ]] ||
[[ "$manifest" =~ sdk_commit=\"([0-9a-f]+)\"\ sdk_version=\"([^\"]+)\" ]]; then
sdk_sha=${BASH_REMATCH[1]}
sdk_version=${BASH_REMATCH[2]}
git fetch --all --tags
git checkout --force "$sdk_sha"
else
git fetch --tags
git checkout --force "v$sdk_version"
fi
if [[ "$manifest" =~ runtime:([0-9a-f]+),\ ([^[:space:]]+) ]] ||
[[ "$manifest" =~ runtime_commit=\"[0-9a-f]+\"\ runtime_version=\"([^\"]+)\" ]]; then
runtime_version="${BASH_REMATCH[2]:-${BASH_REMATCH[1]}}"
fi
popd
(($(echo "$sdk_version" | cut -d. -f1) >= 10)) || {
echo "SDK version less than 10 not supported"
exit 0
}
echo "runtime_version=$runtime_version" >dotnet-versions
echo_version "$sdk_version" >>dotnet-versions
git add dotnet
git add dotnet-versions
git commit --allow-empty --message="v$sdk_version" --signoff
git tag "v$sdk_version"