@@ -19,14 +19,12 @@ $revision = $NULL -ne $env:CI_BUILD_NUMBER ? "{0:00000}" -f [Convert]::ToInt32("
19
19
20
20
# add a suffix if this is not a tag build
21
21
$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
29
23
24
+ Write-Output " build: Branch: $brach "
25
+ Write-Output " build: Revision: $revision "
26
+ Write-Output " build: VersionPrefix: $prefix "
27
+ Write-Output " build: VersionSuffix: $suffix "
30
28
31
29
foreach ($src in Get-ChildItem src/* ) {
32
30
Push-Location $src
@@ -67,8 +65,8 @@ foreach ($test in Get-ChildItem test/*.Tests) {
67
65
Pop-Location
68
66
69
67
if ($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" )) )) {
72
70
# GitHub Actions will only supply this to branch builds and not PRs. We publish
73
71
# builds from any branch this action targets (i.e. master and dev).
74
72
@@ -79,4 +77,6 @@ if ($env:NUGET_API_KEY `
79
77
& dotnet nuget push - k $env: NUGET_API_KEY - s https:// api.nuget.org/ v3/ index.json " $nupkg " -- no- symbols
80
78
if ($LASTEXITCODE -ne 0 ) { throw " Publishing failed" }
81
79
}
80
+ } else {
81
+ Write-Output " build: Skipping Nuget publish"
82
82
}
0 commit comments