This repository has been archived by the owner on Jul 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAppVeyor-Build.ps1
68 lines (50 loc) · 2.72 KB
/
AppVeyor-Build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Write-Host "`nAppVeyor-Build script executed"
Write-Host "=============================="
# Before build
Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1"
.\Set-BuildVersion.ps1
# Use this script after UWPHelper went out of preview
# Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1"
# .\Set-PureBuildVersion.ps1
$buildVersion = $env:APPVEYOR_BUILD_VERSION
# Check whether this is commit in branch 'master' and not just PR to the branch
if (($env:APPVEYOR_REPO_BRANCH -eq "master") -and ($env:APPVEYOR_PULL_REQUEST_TITLE -eq $null) -and ($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null))
{
$newVersion = $buildVersion.Split("-") | Select-Object -first 1
$newVersion = "$newVersion-preview"
$message = "Build version changed from '$buildVersion' to '$newVersion'."
$buildVersion = $newVersion
Update-AppveyorBuild -Version $buildVersion
# Set the environment variable explicitly so it will be preserved to deployments (specifically GitHub Releases)
Set-AppveyorBuildVariable "APPVEYOR_BUILD_VERSION" $buildVersion
Add-AppveyorMessage $message
Write-Host $message
}
# Have to use different version because of a bug in 4.0.0
Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe"
.\nuget restore -source "https://api.nuget.org/v3/index.json;https://www.myget.org/F/bramborman/api/v3/index.json"
# Build
$uwpHelperProjectFolder = Get-ChildItem -Directory -Filter "UWPHelper"
if (!(Test-Path $uwpHelperProjectFolder))
{
throw "Unable to find UWPHelper project folder. `$uwpHelperProjectFolder: '$uwpHelperProjectFolder'"
}
$platforms = "x86", "x64", "ARM"
foreach ($platform in $platforms)
{
Write-Host "`n`nPlatform $platform"
Write-Host "============"
MSBuild "$uwpHelperProjectFolder\UWPHelper.csproj" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Release /p:Platform=$platform
$releaseFolder = Join-Path $uwpHelperProjectFolder.FullName "\bin\$platform\Release\"
if (!(Test-Path $releaseFolder))
{
throw "Unable to find $platform release folder. `$releaseFolder: '$releaseFolder'"
}
$zipFileName = "UWPHelper_$platform.$env:APPVEYOR_BUILD_VERSION.zip"
7z a $zipFileName "$releaseFolder\*"
Push-AppveyorArtifact $zipFileName
}
Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/NuGet-Pack.ps1"
.\NuGet-Pack.ps1 -UWPMultiArchitecture -DllFilter "UWPHelper.dll" -ProjectFoldersFilter "UWPHelper"
Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1"
.\Deployment-Skipping.ps1