File: pushnuget.ps1

package info (click to toggle)
libcsfml 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,176 kB
  • sloc: cpp: 6,052; ansic: 2,530; sh: 790; makefile: 8
file content (28 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (2)
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
Param(
    [Parameter(Mandatory, Position = 0)]
    [string]$APIKey
)

dotnet pack -c Release
if ($LASTEXITCODE -ne 0) {
    Write-Error "Build failed"
    exit 1
}

$count = 0
$packages = (Get-ChildItem */bin/Release/*.nupkg)
foreach ($package in $packages) {
    Write-Progress "Pushing packages" -CurrentOperation "Pushing $($package.Name)" -PercentComplete (($count * 100.0) / $packages.Length)

    dotnet nuget push -k $APIKey -s https://api.nuget.org/v3/index.json $package.FullName

    if ($LASTEXITCODE -ne 0) {
        Write-Error "Unable to push $($package.Name)"
        exit 1
    }

    $count++
}

Write-Progress "Done" -Completed
Write-Output "Successfully pushed $count packages"