|
|
@ -2,7 +2,7 @@ param( |
|
|
[string]$targetFramework = 'ALL' |
|
|
[string]$targetFramework = 'ALL' |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
# lets calulat the correct version here |
|
|
# Lets calculate the correct version here |
|
|
$fallbackVersion = "1.0.0"; |
|
|
$fallbackVersion = "1.0.0"; |
|
|
$version = '' |
|
|
$version = '' |
|
|
|
|
|
|
|
|
@ -10,13 +10,14 @@ $tagRegex = '^v?(\d+\.\d+\.\d+)(?:-([a-zA-Z]+)\.?(\d*))?$' |
|
|
|
|
|
|
|
|
$skipFullFramework = 'false' |
|
|
$skipFullFramework = 'false' |
|
|
|
|
|
|
|
|
# if we are trying to build only netcoreapp versions for testings then skip building the full framework targets |
|
|
# If we are trying to build only netcoreapp versions for testings then skip building the full framework targets |
|
|
if ("$targetFramework".StartsWith("netcoreapp")) { |
|
|
if ("$targetFramework".StartsWith("netcoreapp")) { |
|
|
$skipFullFramework = 'true' |
|
|
$skipFullFramework = 'true' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function ToBuildNumber { |
|
|
function ToBuildNumber { |
|
|
param( $date ) |
|
|
param( $date ) |
|
|
|
|
|
|
|
|
if ("$date" -eq "") { |
|
|
if ("$date" -eq "") { |
|
|
$date = [System.DateTime]::Now |
|
|
$date = [System.DateTime]::Now |
|
|
} |
|
|
} |
|
|
@ -25,32 +26,14 @@ function ToBuildNumber { |
|
|
$date = [System.DateTime]::Parse($date) |
|
|
$date = [System.DateTime]::Parse($date) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $date.ToString("yyyyMMddhhmmss") |
|
|
return $date.ToString("yyyyMMddhhmmss") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# if($IsWindows){ |
|
|
# We are running on the build server |
|
|
# $skipFullFramework = 'true' |
|
|
$isVersionTag = "$env:GITHUB_REF".replace("refs/tags/", "") -match $tagRegex |
|
|
# Write-Info "Building full framework targets - Running windows" |
|
|
|
|
|
# }else{ |
|
|
|
|
|
# if (Get-Command "mono" -ErrorAction SilentlyContinue) |
|
|
|
|
|
# { |
|
|
|
|
|
# Write-Info "Building full framework targets - mono installed" |
|
|
|
|
|
# $skipFullFramework = 'true' |
|
|
|
|
|
# } |
|
|
|
|
|
# } |
|
|
|
|
|
|
|
|
|
|
|
# we are running on the build server |
|
|
if ($isVersionTag) { |
|
|
$isVersionTag = $env:APPVEYOR_REPO_TAG_NAME -match $tagRegex |
|
|
|
|
|
|
|
|
|
|
|
if ($isVersionTag -eq $false) { |
|
|
|
|
|
$isVersionTag = "$env:GITHUB_REF".replace("refs/tags/", "") -match $tagRegex |
|
|
|
|
|
if ($isVersionTag) { |
|
|
|
|
|
Write-Debug "Github tagged build" |
|
|
Write-Debug "Github tagged build" |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
Write-Debug "Appveyor tagged build" |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($isVersionTag -eq $false) { |
|
|
if ($isVersionTag -eq $false) { |
|
|
@ -75,13 +58,16 @@ if ($isVersionTag) { |
|
|
$version = $matches[1] |
|
|
$version = $matches[1] |
|
|
$postTag = $matches[2] |
|
|
$postTag = $matches[2] |
|
|
$count = $matches[3] |
|
|
$count = $matches[3] |
|
|
Write-Debug "version number: ${version} post tag: ${postTag} count: ${count}" |
|
|
|
|
|
|
|
|
Write-Debug "Version number: ${version} post tag: ${postTag} count: ${count}" |
|
|
|
|
|
|
|
|
if ("$postTag" -ne "") { |
|
|
if ("$postTag" -ne "") { |
|
|
$version = "${version}-${postTag}" |
|
|
$version = "${version}-${postTag}" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ("$count" -ne "") { |
|
|
if ("$count" -ne "") { |
|
|
# for consistancy with previous releases we pad the counter to only 4 places |
|
|
# For consistancy with previous releases we pad the counter to only 4 places |
|
|
$padded = $count.Trim().Trim('0').PadLeft(4, "0"); |
|
|
$padded = $count.Trim().PadLeft(4, "0"); |
|
|
Write-Debug "count '$count', padded '${padded}'" |
|
|
Write-Debug "count '$count', padded '${padded}'" |
|
|
|
|
|
|
|
|
$version = "${version}${padded}" |
|
|
$version = "${version}${padded}" |
|
|
@ -94,10 +80,10 @@ else { |
|
|
$list = $lastTag.Split("`n") |
|
|
$list = $lastTag.Split("`n") |
|
|
foreach ($tag in $list) { |
|
|
foreach ($tag in $list) { |
|
|
|
|
|
|
|
|
Write-Debug "testing ${tag}" |
|
|
Write-Debug "Testing ${tag}" |
|
|
$tag = $tag.Trim(); |
|
|
$tag = $tag.Trim(); |
|
|
if ($tag -match $tagRegex) { |
|
|
if ($tag -match $tagRegex) { |
|
|
Write-Debug "matched ${tag}" |
|
|
Write-Debug "Matched ${tag}" |
|
|
$version = $matches[1]; |
|
|
$version = $matches[1]; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
@ -112,11 +98,8 @@ else { |
|
|
Write-Debug "Discovered base version from tags '${version}'" |
|
|
Write-Debug "Discovered base version from tags '${version}'" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$buildNumber = $env:APPVEYOR_BUILD_NUMBER |
|
|
# Create a build number based on the current time. |
|
|
|
|
|
$buildNumber = "" |
|
|
if ("$buildNumber" -eq "") { |
|
|
|
|
|
# no counter availible in this environment |
|
|
|
|
|
# let make one up based on time |
|
|
|
|
|
|
|
|
|
|
|
if ( "$env:GITHUB_SHA" -ne '') { |
|
|
if ( "$env:GITHUB_SHA" -ne '') { |
|
|
$buildNumber = ToBuildNumber (git show -s --format=%ci $env:GITHUB_SHA) |
|
|
$buildNumber = ToBuildNumber (git show -s --format=%ci $env:GITHUB_SHA) |
|
|
@ -127,33 +110,17 @@ else { |
|
|
else { |
|
|
else { |
|
|
$buildNumber = ToBuildNumber |
|
|
$buildNumber = ToBuildNumber |
|
|
} |
|
|
} |
|
|
$buildNumber = "$buildNumber".Trim().Trim('0').PadLeft(12, "0"); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
# build number replacement is padded to 6 places |
|
|
|
|
|
$buildNumber = "$buildNumber".Trim().Trim('0').PadLeft(6, "0"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ("$env:APPVEYOR_PULL_REQUEST_NUMBER" -ne "") { |
|
|
|
|
|
Write-Debug "building a PR" |
|
|
|
|
|
|
|
|
|
|
|
$prNumber = "$env:APPVEYOR_PULL_REQUEST_NUMBER".Trim().Trim('0').PadLeft(5, "0"); |
|
|
$buildNumber = "$buildNumber".Trim().PadLeft(12, "0"); |
|
|
# this is a PR |
|
|
|
|
|
$version = "${version}-PullRequest${prNumber}${buildNumber}"; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
Write-Debug "building a branch commit" |
|
|
|
|
|
|
|
|
|
|
|
# this is a general branch commit |
|
|
Write-Debug "Building a branch commit" |
|
|
$branch = $env:APPVEYOR_REPO_BRANCH |
|
|
|
|
|
|
|
|
|
|
|
if ("$branch" -eq "") { |
|
|
# This is a general branch commit |
|
|
$branch = ((git rev-parse --abbrev-ref HEAD) | Out-String).Trim() |
|
|
$branch = ((git rev-parse --abbrev-ref HEAD) | Out-String).Trim() |
|
|
|
|
|
|
|
|
if ("$branch" -eq "") { |
|
|
if ("$branch" -eq "") { |
|
|
$branch = "unknown" |
|
|
$branch = "unknown" |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$branch = $branch.Replace("/", "-").ToLower() |
|
|
$branch = $branch.Replace("/", "-").ToLower() |
|
|
|
|
|
|
|
|
@ -162,21 +129,12 @@ else { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$version = "${version}-${branch}${buildNumber}"; |
|
|
$version = "${version}-${branch}${buildNumber}"; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ("$env:APPVEYOR_API_URL" -ne "") { |
|
|
|
|
|
# update appveyor build number for this build |
|
|
|
|
|
Invoke-RestMethod -Method "PUT" ` |
|
|
|
|
|
-Uri "${env:APPVEYOR_API_URL}api/build" ` |
|
|
|
|
|
-Body "{version:'${version}'}" ` |
|
|
|
|
|
-ContentType "application/json" |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Write-Host "Building version '${version}'" |
|
|
Write-Host "Building version '${version}'" |
|
|
dotnet restore /p:packageversion=$version /p:DisableImplicitNuGetFallbackFolder=true /p:skipFullFramework=$skipFullFramework |
|
|
dotnet restore /p:packageversion=$version /p:DisableImplicitNuGetFallbackFolder=true /p:skipFullFramework=$skipFullFramework |
|
|
|
|
|
|
|
|
$repositoryUrl = "https://github.com/SixLabors/ImageSharp/" |
|
|
$repositoryUrl = "https://github.com/SixLabors/" |
|
|
|
|
|
|
|
|
if ("$env:GITHUB_REPOSITORY" -ne "") { |
|
|
if ("$env:GITHUB_REPOSITORY" -ne "") { |
|
|
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY" |
|
|
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY" |
|
|
@ -187,19 +145,7 @@ dotnet build -c Release /p:packageversion=$version /p:skipFullFramework=$skipFul |
|
|
|
|
|
|
|
|
if ($LASTEXITCODE ) { Exit $LASTEXITCODE } |
|
|
if ($LASTEXITCODE ) { Exit $LASTEXITCODE } |
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
# TODO: DO WE NEED TO RUN TESTS IMPLICITLY? |
|
|
|
|
|
# |
|
|
|
|
|
# if ( $env:CI -ne "True") { |
|
|
|
|
|
# cd ./tests/ImageSharp.Tests/ |
|
|
|
|
|
# dotnet xunit -nobuild -c Release -f netcoreapp2.0 --fx-version 2.0.0 |
|
|
|
|
|
# ./RunExtendedTests.cmd |
|
|
|
|
|
# cd ../.. |
|
|
|
|
|
# } |
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
if ($LASTEXITCODE ) { Exit $LASTEXITCODE } |
|
|
|
|
|
|
|
|
|
|
|
Write-Host "Packaging projects" |
|
|
Write-Host "Packaging projects" |
|
|
dotnet pack ./src/ImageSharp/ -c Release --output "$PSScriptRoot/artifacts" --no-build /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl |
|
|
|
|
|
|
|
|
dotnet pack -c Release --output "$PSScriptRoot/artifacts" --no-build /p:packageversion=$version /p:skipFullFramework=$skipFullFramework /p:RepositoryUrl=$repositoryUrl |
|
|
if ($LASTEXITCODE ) { Exit $LASTEXITCODE } |
|
|
if ($LASTEXITCODE ) { Exit $LASTEXITCODE } |
|
|
|