-
Notifications
You must be signed in to change notification settings - Fork 4k
/
CreateAndUploadNugetZip.ps1
53 lines (40 loc) · 1.65 KB
/
CreateAndUploadNugetZip.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
$ScriptDir = $PSScriptRoot
$AzCopyLoc = Join-Path ${env:ProgramFiles(x86)} "Microsoft SDKs\Azure\AzCopy\AzCopy.exe"
If (-Not (Test-Path $AzCopyLoc)) {
echo "Azure Copy could not be found. Download and install here:"
echo "http://aka.ms/downloadazcopy"
exit 1
}
$Branch = Read-Host 'which branch is this for? [Main|Future]'
$Version = Read-Host 'which version of the zip file is this?'
$AzureKey = Read-Host 'what is the azure key?'
$MaybeFuture = ""
If ($Branch -eq "future") {
$MaybeFuture = ".future"
}
$NugetZipName = "nuget$MaybeFuture.$Version.zip"
echo "==============================================="
echo "= Clearing nuget caches"
echo "==============================================="
echo ""
# & $ScriptDir\..\..\..\Binaries\Tools\nuget.exe locals all -clear
echo ""
echo "==============================================="
echo "= Restoring nuget to fill cache"
echo "==============================================="
echo ""
& $ScriptDir\..\..\..\Restore.cmd
echo ""
echo "==============================================="
echo "= Zipping $HOME/.nuget into $ScriptDir/$NugetZipName "
echo "==============================================="
echo ""
Add-Type -Assembly "System.IO.Compression.FileSystem";
[System.IO.Compression.ZipFile]::CreateFromDirectory("$HOME/.nuget", "$ScriptDir/$NugetZipName", "Fastest", $true);
echo "Done"
echo ""
echo "==============================================="
echo "= Uploading $ScriptDir/$NugetZipName"
echo "==============================================="
echo ""
& $AzCopyLoc /Source:$ScriptDir /Dest:https://dotnetci.blob.core.windows.net/roslyn /DestKey:$AzureKey /Pattern:$NugetZipName