Merge pull request #1083 from blackdwarf/badges

Add version badges generation to build
This commit is contained in:
Zlatko Knezevic 2016-02-03 12:57:40 -08:00
commit a7f438f85d
6 changed files with 75 additions and 0 deletions

5
.gitignore vendored
View file

@ -269,3 +269,8 @@ _Pvt_Extensions
# Exceptions
# Build Scripts
!scripts/build/
test/PackagedCommands/Consumers/*/project.json
# Vim swp files
*.swp
*.*~

View file

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="102" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="a">
<rect width="102" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#a)">
<path fill="#555" d="M0 0h52v20H0z" />
<path fill="#007ec6" d="M52 0h50v20H52z" />
<path fill="url(#b)" d="M0 0h102v20H0z" />
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="26" y="15" fill="#010101" fill-opacity=".3">version</text>
<text x="26" y="14">version</text>
<text x="76" y="15" fill="#010101" fill-opacity=".3">ver_number</text>
<text x="76" y="14">ver_number</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 882 B

View file

@ -14,3 +14,10 @@ _ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
header "Generating NuGet packages"
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$env:VersionSuffix")
header "Generating version badge"
$VersionBadge = "$RepoRoot\resources\images\version_badge.svg"
$BadgeDestination = "$RepoRoot\artifacts\version_badge.svg"
(get-content $VersionBadge).replace("ver_number", "$env:DOTNET_CLI_VERSION") | set-content $BadgeDestination
& "$RepoRoot\scripts\publish\publish.ps1" -file $BadgeDestination

View file

@ -20,8 +20,18 @@ if [ -z "$DOTNET_CLI_VERSION" ]; then
DOTNET_CLI_VERSION=0.0.1-dev-t$TIMESTAMP
fi
$VERSION_BADGE="$REPOROOT/resources/images/version_badge.svg"
$BADGE_DESTINATION="$REPOROOT/artifacts/version_badge.svg"
header "Generating tarball"
$DIR/package-dnvm.sh
header "Generating Native Installer"
$DIR/package-native.sh
header "Generating version badge"
sed "s/ver_number/$DOTNET_CLI_VERSION/g" $VERSION_BADGE > $BADGE_DESTINATION
header "Publishing version badge"
$REPOROOT/scripts/publish/publish.sh $BADGE_DESTINATION

View file

@ -135,6 +135,19 @@ function UploadInstallers($msiFile)
return 0
}
function UploadVersionBadge($badgeFile)
{
$fileName = "windows_$Configuration_$([System.IO.Path]::GetFileName($badgeFile))"
Write-Host "Uploading the version badge to Latest"
UploadFile "dev/Binaries/Latest/$filename" $badgeFile
Write-Host "Uploading the version badge to $env:DOTNET_CLI_VERSION"
UploadFile "dev/Binaries/$env:DOTNET_CLI_VERSION/$filename" $badgeFile
return 0
}
if(!(CheckRequiredVariables))
{
# fail silently if the required variables are not available for publishing the file
@ -156,5 +169,9 @@ elseif([System.IO.Path]::GetExtension($file).ToLower() -eq ".msi")
{
$result = UploadInstallers $file
}
elseif ([System.IO.Path]::GetExtension($file).ToLower() -eq ".svg")
{
$result = UploadVersionBadge $file
}
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_version_badge $UPLOAD_FILE
result=$?
fi
exit $result
@ -187,6 +190,19 @@ upload_installers_to_blob_storage(){
return 0
}
upload_version_badge(){
local badgefile=$1
local filename="$OSNAME_$CONFIGURATION_$(basename $badgefile)"
echo "Uploading the version badge to Latest"
upload_file_to_blob_storage_azure_cli "dev/Binaries/Latest/$filename" $badgefile
echo "Uploading the version badge to $DOTNET_CLI_VERSION"
upload_file_to_blob_storage_azure_cli "dev/Binaries/$DOTNET_CLI_VERSION/$filename" $badgefile
return 0
}
generate_repoclient_json(){
# Clean any existing json file
rm -f $SCRIPT_DIR/$UPLOAD_JSON_FILE