Add version badges generation to build

Add version badge generation using shields.io service. The badge
is uploaded to a fixed Azure BLOB location which can be referenced
from README.md. Since the badge creation is not crucial, do not fail the build
if it cannot be created.

Fix #1000
This commit is contained in:
Zlatko Knezevic 2016-01-27 22:00:58 -08:00
parent 2d04bdcd17
commit 95f059697f
4 changed files with 31 additions and 0 deletions

View file

@ -14,3 +14,12 @@ _ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
header "Generating NuGet packages"
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$env:VersionSuffix")
header "Downloading version badge"
$VersionBadge = "$RepoRoot\artifacts\version_badge.svg"
$r = Invoke-WebRequest -Uri "https://img.shields.io/badge/version-$env:DOTNET_CLI_VERSION-blue.svg" -OutFile $VersionBadge
if ($r.StatusCode == 200)
{
& "$RepoRoot\publish\publish.ps1" "$RepoRoot\artifacts\version_badge.svg" -file $VersionBadge
}

View file

@ -15,13 +15,27 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
source "$REPOROOT/scripts/build/generate-version.sh"
if [ -z "$DOTNET_CLI_VERSION" ]; then
TIMESTAMP=$(date "+%Y%m%d%H%M%S")
DOTNET_CLI_VERSION=0.0.1-dev-t$TIMESTAMP
fi
$VERSION_BADGE="$REPOROOT/artifacts/version_badge.svg"
header "Generating tarball"
$DIR/package-dnvm.sh
header "Generating Native Installer"
$DIR/package-native.sh
header "Downloading version badge"
status_code=$(curl -w "%{http_code}" -s -o $VERSION_BADGE "https://img.shields.io/badge/version-$DOTNET_CLI_VERSION-blue.svg")
if [ "$status_code" -eq "200"]; then
header "Publishing version badge"
$REPOROOT/scripts/publish/publish.sh $VERSION_BADGE
else
info "Downloading the badge failed - $status_code"
fi

View file

@ -156,5 +156,10 @@ elseif([System.IO.Path]::GetExtension($file).ToLower() -eq ".msi")
{
$result = UploadInstallers $file
}
elseif ([System.IO.Path]::GetExtension($file).ToLower() -eq ".svg")
{
UploadFile "dev/Binaries/Latest/$([System.IO.Path]::GetFileName($file))" $file
$result = $true
}
exit $result

View file

@ -46,6 +46,9 @@ execute(){
elif [[ $UPLOAD_FILE == *.tar.gz ]]; then
upload_binaries_to_blob_storage $UPLOAD_FILE
result=$?
elif [[ $UPLOAD_FILE == *.svg ]]; then
upload_file_to_blob_storage_azure_cli "dev/Binaries/Latest/$(basename $UPLOAD_FILE)" $UPLOAD_FILE
result=0
fi
exit $result