@@ -19,14 +19,12 @@ $revision = $NULL -ne $env:CI_BUILD_NUMBER ? "{0:00000}" -f [Convert]::ToInt32("
1919
2020# add a suffix if this is not a tag build
2121$suffix = $NULL -ne $env: CI_COMMIT_TAG ? " " : " $ ( $branch.Substring (0 , [Math ]::Min(10 , $branch.Length )) -replace ' ([^a-zA-Z0-9\-]*)' , ' ' ) -$revision "
22- $prefix = $NULL -ne $env: CI_COMMIT_TAG ? $env: CI_COMMIT_TAG : $NULL
23-
24- Write-Output $brach
25- Write-Output $revision
26- Write-Output $suffix
27-
28- Write-Output " build: Package version suffix is $suffix "
22+ $prefix = $env: CI_COMMIT_TAG
2923
24+ Write-Output " build: Branch: $brach "
25+ Write-Output " build: Revision: $revision "
26+ Write-Output " build: VersionPrefix: $prefix "
27+ Write-Output " build: VersionSuffix: $suffix "
3028
3129foreach ($src in Get-ChildItem src/* ) {
3230 Push-Location $src
@@ -67,8 +65,8 @@ foreach ($test in Get-ChildItem test/*.Tests) {
6765Pop-Location
6866
6967if ($env: NUGET_API_KEY `
70- -and ($NULL -ne $suffix -or $NULL -ne $prefix ) `
71- - and ($env: CI_TARGET_BRANCH -eq " dev" -or $env: CI_TARGET_BRANCH -eq " master" )) {
68+ -and (( " tag " -eq $ env: GITHUB_REF_NAME -and $NULL -ne $prefix ) `
69+ -or ( $NULL -ne $suffix - and ($env: CI_TARGET_BRANCH -eq " dev" -or $env: CI_TARGET_BRANCH -eq " master" )) )) {
7270 # GitHub Actions will only supply this to branch builds and not PRs. We publish
7371 # builds from any branch this action targets (i.e. master and dev).
7472
@@ -79,4 +77,6 @@ if ($env:NUGET_API_KEY `
7977 & dotnet nuget push - k $env: NUGET_API_KEY - s https:// api.nuget.org/ v3/ index.json " $nupkg " -- no- symbols
8078 if ($LASTEXITCODE -ne 0 ) { throw " Publishing failed" }
8179 }
80+ } else {
81+ Write-Output " build: Skipping Nuget publish"
8282}
0 commit comments