This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
forked from slunyakin-zz/parquet-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappveyor.ps1
95 lines (72 loc) · 2.81 KB
/
appveyor.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
### AppVeyor specific code
#APPVEYOR_BUILD_VERSION=1.0.21
$Copyright = "Copyright (c) 2017 by Elastacloud Ltd."
$PackageIconUrl = "http://i.isolineltd.com/nuget/parquet.png"
$PackageProjectUrl = "https://github.com/elastacloud/parquet-dotnet"
$RepositoryUrl = "https://github.com/elastacloud/parquet-dotnet"
$Authors = "Ivan Gavryliuk (@aloneguid); Richard Conway (@azurecoder)"
$PackageLicenseUrl = "https://github.com/elastacloud/parquet-dotnet/blob/master/LICENSE"
$RepositoryType = "GitHub"
$gv = $env:APPVEYOR_BUILD_VERSION
if($gv -eq $null)
{
$gv = "1.0.0"
}
function Update-ProjectVersion($File)
{
$v = $gv
$xml = [xml](Get-Content $File.FullName)
if($xml.Project.PropertyGroup.Count -eq $null)
{
$pg = $xml.Project.PropertyGroup
}
else
{
$pg = $xml.Project.PropertyGroup[0]
}
$parts = $v -split "\."
$bv = $parts[2]
if($bv.Contains("-")) { $bv = $bv.Substring(0, $bv.IndexOf("-"))}
$fv = "{0}.{1}.{2}.0" -f $parts[0], $parts[1], $bv
$av = "{0}.0.0.0" -f $parts[0]
$pv = $v
$pg.Version = $pv
$pg.FileVersion = $fv
$pg.AssemblyVersion = $av
Write-Host "$($File.Name) => fv: $fv, av: $av, pkg: $pv"
$pg.Copyright = $Copyright
$pg.PackageIconUrl = $PackageIconUrl
$pg.PackageProjectUrl = $PackageProjectUrl
$pg.RepositoryUrl = $RepositoryUrl
$pg.Authors = $Authors
$pg.PackageLicenseUrl = $PackageLicenseUrl
$pg.RepositoryType = $RepositoryType
$xml.Save($File.FullName)
}
function Remove-AllNuGetPackagePreviews($PackageId, $ApiKey, $Keyword, $PreviewsToKeep, $VersionsToMaintain)
{
$lower = $PackageId.ToLowerInvariant();
$json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$lower/index.json" | ConvertFrom-Json
$filteredVersions = $json.versions | Where-Object { $_ -like "*$Keyword*"} | Select-Object -Last $VersionsToMaintain
$count = $filteredVersions.Count
$removed = 0
Write-Host "found $count versions"
foreach($version in $filteredVersions)
{
$versionsLeft = $count - $removed
if($versionsLeft -lt $PreviewsToKeep)
{
Write-Host "only $versionsLeft left, need to keep $PreviewsToKeep"
break;
}
Write-Host "Unlisting $PackageId, Ver $version"
Invoke-Expression "nuget delete $PackageId $version $ApiKey -source https://api.nuget.org/v3/index.json -NonInteractive"
$removed += 1
}
}
Invoke-Expression "nuget restore src/Parquet.sln"
# Update versioning information
Get-ChildItem *.csproj -Recurse | Where-Object {-not(($_.Name -like "*test*") -or ($_.Name -like "*parq.csproj*") -or ($_.Name -like "*utils.csproj") -or ($_.Name -like "*Runner.csproj*") ) } | % {
Update-ProjectVersion $_
}
#Remove-AllNuGetPackagePreviews -PackageId "Parquet.Net" -ApiKey $env:NUGET_KEY -Keyword "alpha" -PreviewsToKeep 3 -VersionsToMaintain 6