Use Nerdbank.GitVersioning
This commit is contained in:
Родитель
cba49f1802
Коммит
47c8d2c952
|
@ -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="CleanBaseOutput" AfterTargets="Clean">
|
||||
|
|
|
@ -83,10 +83,6 @@ stages:
|
|||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: CmdLine@2
|
||||
displayName: 'Set Version'
|
||||
inputs:
|
||||
script: ./setversion.sh $(Build.BuildNumber)
|
||||
- task: Docker@2
|
||||
displayName: Build and Push
|
||||
inputs:
|
||||
|
|
|
@ -1,77 +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:<SteeltoeNetCoreToolServiceVersion>.*</SteeltoeNetCoreToolServiceVersion>:<SteeltoeNetCoreToolServiceVersion>'$major.$minor.$patch'</SteeltoeNetCoreToolServiceVersion>:' $base_dir/Version.props
|
|
@ -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}"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче