Skip to content

Commit 2e59bf7

Browse files
Fix missing symbol package upload (#357)
Co-authored-by: Aaron Stannard <[email protected]>
1 parent 48d8463 commit 2e59bf7

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

build-system/windows-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ steps:
3232
TEST_ENVIRONMENT: "CICD"
3333
inputs:
3434
filename: build.cmd
35-
arguments: 'nuget nugetpublishurl=https://www.nuget.org/api/v2/package nugetkey=$(nugetKey)'
35+
arguments: 'nuget nugetpublishurl=https://api.nuget.org/v3/index.json nugetkey=$(nugetKey)'
3636

3737
- task: GitHubRelease@0
3838
displayName: 'GitHub release (create)'

build.fsx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -284,38 +284,40 @@ Target "CreateNuget" (fun _ ->
284284
{ p with
285285
Project = project
286286
Configuration = configuration
287-
AdditionalArgs = ["--include-symbols --no-build"]
287+
AdditionalArgs = ["--no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg"]
288288
VersionSuffix = overrideVersionSuffix project
289-
OutputPath = outputNuGet })
289+
OutputPath = "\"" + outputNuGet + "\"" })
290290

291291
projects |> Seq.iter (runSingleProject)
292292
)
293293

294294
Target "PublishNuget" (fun _ ->
295-
let projects = !! "./bin/nuget/*.nupkg" -- "./bin/nuget/*.symbols.nupkg"
296-
let apiKey = getBuildParamOrDefault "nugetkey" ""
297-
let source = getBuildParamOrDefault "nugetpublishurl" ""
298-
let symbolSource = getBuildParamOrDefault "symbolspublishurl" ""
299-
let shouldPublishSymbolsPackages = not (symbolSource = "")
300-
301-
if (not (source = "") && not (apiKey = "") && shouldPublishSymbolsPackages) then
302-
let runSingleProject project =
303-
DotNetCli.RunCommand
304-
(fun p ->
305-
{ p with
306-
TimeOut = TimeSpan.FromMinutes 10. })
307-
(sprintf "nuget push %s --api-key %s --source %s --symbol-source %s" project apiKey source symbolSource)
308-
309-
projects |> Seq.iter (runSingleProject)
310-
else if (not (source = "") && not (apiKey = "") && not shouldPublishSymbolsPackages) then
311-
let runSingleProject project =
312-
DotNetCli.RunCommand
313-
(fun p ->
314-
{ p with
315-
TimeOut = TimeSpan.FromMinutes 10. })
316-
(sprintf "nuget push %s --api-key %s --source %s" project apiKey source)
317-
318-
projects |> Seq.iter (runSingleProject)
295+
let shouldPushNugetPackages = hasBuildParam "nugetkey"
296+
if not shouldPushNugetPackages then ()
297+
else
298+
let apiKey = getBuildParam "nugetkey"
299+
let sourceUrl = getBuildParamOrDefault "nugetpublishurl" "https://api.nuget.org/v3/index.json"
300+
301+
let rec publishPackage retryLeft packageFile =
302+
tracefn "Pushing %s Attempts left: %d" (FullName packageFile) retryLeft
303+
let tracing = ProcessHelper.enableProcessTracing
304+
try
305+
try
306+
ProcessHelper.enableProcessTracing <- false
307+
DotNetCli.RunCommand
308+
(fun p ->
309+
{ p with
310+
TimeOut = TimeSpan.FromMinutes 10. })
311+
(sprintf "nuget push %s --api-key %s --source %s --no-service-endpoint" packageFile apiKey sourceUrl)
312+
with exn ->
313+
if (retryLeft > 0) then (publishPackage (retryLeft-1) packageFile)
314+
finally
315+
ProcessHelper.enableProcessTracing <- tracing
316+
317+
printfn "Pushing nuget packages"
318+
let normalPackages = !! (outputNuGet @@ "*.nupkg") |> Seq.sortBy(fun x -> x.ToLower())
319+
for package in normalPackages do
320+
publishPackage 3 package
319321
)
320322

321323
//--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)