Skip to content

Commit 1b5d95c

Browse files
committed
update publish
1 parent 16dc0db commit 1b5d95c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

build-packages.ps1

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
$output = "./nupkgs"
22
$version = "0.0.1"
33
$publishConfig = "./nuget/publish-config.json"
4+
45
$json = Get-Content $publishConfig -Raw | ConvertFrom-Json
56

6-
Write-Host $json.packagesPaths
7+
Write-Host "Packages to publish"
8+
Write-Host "--------------------------------------------------------"
9+
Write-Host ($json.packagesPaths -join "`n")
710

811
dotnet restore
912

1013
dotnet build --no-restore --configuration Release
1114

15+
if($LASTEXITCODE -ne 0)
16+
{
17+
throw "dotnet build failed"
18+
}
19+
1220
dotnet test --no-build --verbosity normal --configuration Release
1321

14-
foreach ( $path in $json.packagesPaths ){
15-
dotnet pack $path --output $output --no-build --configuration Release -p:PackageVersion=$version
22+
if($LASTEXITCODE -ne 0)
23+
{
24+
throw "dotnet test failed"
1625
}
1726

27+
foreach ( $path in $json.packagesPaths ){
28+
$r = dotnet pack $path --output $output --no-build --configuration Release -p:PackageVersion=$version
29+
}

publish-nuget.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
$artifacts = "./nupkgs"
22
$NugetApiKey = ""
3+
$publishConfig = "./nuget/publish-config.json"
4+
5+
$json = Get-Content $publishConfig -Raw | ConvertFrom-Json
36

47
$filenames = (Get-ChildItem -Path $artifacts | Select Name).Name
58

9+
$count = $json.packagesPaths.Count
10+
$actualCount = $filenames.Length
11+
12+
if($count -ne $actualCount)
13+
{
14+
throw "Packages count is $count but actual count is $actualCount"
15+
}
16+
617
foreach($name in $filenames){
718
dotnet nuget push ./nupkgs/$name --source https://api.nuget.org/v3/index.json --api-key $NugetApiKey
819
}

0 commit comments

Comments
 (0)