Use Nerdbank.GitVersioning
This commit is contained in:
Родитель
2ff9568627
Коммит
eed4b10a4d
|
@ -5,6 +5,13 @@
|
|||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
|
||||
<Version>3.4.*</Version>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="Version.props" />
|
||||
|
||||
<Target Name="Pristine" AfterTargets="Clean">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<GoogleAnalyticsTrackerVersion>6.0.7</GoogleAnalyticsTrackerVersion>
|
||||
<SteeltoeInitializrServiceVersion>0.0.0</SteeltoeInitializrServiceVersion>
|
||||
<SteeltoeVersion>3.1.0</SteeltoeVersion>
|
||||
<YamlDotNetVersion>8.1.2</YamlDotNetVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
prog=$(basename $0)
|
||||
base_dir=$(cd $(dirname $0) && pwd)
|
||||
|
||||
if command -v gsed >/dev/null; then
|
||||
sed=gsed
|
||||
else
|
||||
sed=sed
|
||||
fi
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
USAGE
|
||||
$prog [-h] version
|
||||
WHERE
|
||||
version
|
||||
Template version in <major>.<minor>.<patch> format.
|
||||
OPTIONS
|
||||
-h print this message
|
||||
DESCRIPTION
|
||||
Updates the NuGet spec and DevOps pipeline with the specified version.
|
||||
EOF
|
||||
}
|
||||
|
||||
die() {
|
||||
echo $* 2>&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts ":h" opt ; do
|
||||
case $opt in
|
||||
h)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
\?)
|
||||
die "invalid option -$OPTARG; run with -h for help"
|
||||
;;
|
||||
:)
|
||||
die "option -$OPTARG requires an argument; run with -h for help"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
die "version not specified; run with -h for help"
|
||||
fi
|
||||
|
||||
version=$(echo $1 | cut -d- -f1)
|
||||
shift
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
die "too many args; run with -h for help"
|
||||
fi
|
||||
|
||||
major=$(echo $version | cut -d. -f1)
|
||||
minor=$(echo $version | cut -d. -f2)
|
||||
patch=$(echo $version | cut -d. -f3)
|
||||
|
||||
if [[ "$major.$minor.$patch" != "$version" ]]; then
|
||||
die "version not in major.minor.patch format"
|
||||
fi
|
||||
[[ $major =~ ^-?[0-9]+$ ]] || die "invalid major value: $major"
|
||||
[[ $minor =~ ^-?[0-9]+$ ]] || die "invalid minor value: $minor"
|
||||
[[ $patch =~ ^-?[0-9]+$ ]] || die "invalid patch value: $patch"
|
||||
|
||||
if ! $sed --version 2>/dev/null | grep 'GNU sed' >/dev/null; then
|
||||
die "This script requires GNU sed"
|
||||
fi
|
||||
|
||||
echo "Setting version to $major.$minor.$patch"
|
||||
|
||||
$sed -i 's:<SteeltoeInitializrServiceVersion>.*</SteeltoeInitializrServiceVersion>:<SteeltoeInitializrServiceVersion>'$major.$minor.$patch'</SteeltoeInitializrServiceVersion>:' $base_dir/Version.props
|
|
@ -19,11 +19,6 @@
|
|||
<NoWarn>SA1101;SA1309;SA1402;SA1649</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version Condition=" '$(BUILD_BUILDNUMBER)' == '' ">$(SteeltoeInitializrServiceVersion)</Version>
|
||||
<Version Condition=" '$(BUILD_BUILDNUMBER)' != '' ">$(BUILD_BUILDNUMBER)</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
|
||||
"version": "1.0.0-rc1",
|
||||
"publicReleaseRefSpec": [
|
||||
"^refs/heads/release/\\d+\\.\\d+$"
|
||||
],
|
||||
"cloudBuild": {
|
||||
"buildNumber": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"release": {
|
||||
"branchName": "release/{version}"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче