-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
upload-releases.ps1
37 lines (32 loc) · 1.32 KB
/
upload-releases.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
[string[]] $existingReleases = & gh release list --repo jessehouwing/azure-pipelines-tasks-zips --limit 500 | Select-String "m\d+-tasks" | %{ $_.Matches.Value }
$knownAssets = @{}
foreach ($release in $existingReleases)
{
$releaseDetails = & gh release view --repo jessehouwing/azure-pipelines-tasks-zips $release --json name,tagName,assets | ConvertFrom-Json
$knownAssets["$release"] = $releaseDetails.assets
}
foreach ($taskzip in (@(Get-ChildItem _gen/*.zip) + @(Get-ChildItem .\_download\*.zip)))
{
$taskzip.Name -match "-(?<version>\d+\.\d+\.\d+)\.zip" | Out-Null
$version = [version]$Matches.version
if ($version.Minor -lt 100)
{
continue
}
if ($knownAssets."m$($version.Minor)-tasks")
{
if ($knownAssets."m$($version.Minor)-tasks" | Where-Object { $_.name -eq $taskzip.Name })
{
continue
}
& gh release upload --repo jessehouwing/azure-pipelines-tasks-zips "m$($version.Minor)-tasks" $taskzip.FullName
}
else {
& gh release create --repo jessehouwing/azure-pipelines-tasks-zips --title "m$($version.Minor) - Tasks" --notes-file .\releasenote.template.md "m$($version.Minor)-tasks" $taskzip.FullName
$knownAssets."m$($version.Minor)-tasks" = @(
@{
name = $taskzip.Name
}
)
}
}