Skip to content

Commit

Permalink
(build) Add additional config for TeamCity build
Browse files Browse the repository at this point in the history
To exclude any generated nupkgs that contain the term rtm in them, and
also to set the releaselabel for different branch names. This will also
allow PR builds to run on TeamCity, but no artifacts will be published
during it.
  • Loading branch information
gep13 committed Apr 28, 2023
1 parent 9ce0a7e commit 57350b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ object ChocolateyNugetClient : BuildType({
-:artifacts/nupkgs/*-beta.nupkg
-:artifacts/nupkgs/*-alpha.nupkg
-:artifacts/nupkgs/*-rc.nupkg
-:artifacts/nugkgs/*-rtm*.nupkg
""".trimIndent()

vcs {
Expand Down Expand Up @@ -60,6 +61,9 @@ object ChocolateyNugetClient : BuildType({
elseif ( ${'$'}branchName.StartsWith('release') ) { ${'$'}releaseLabel = 'beta' }
elseif ( ${'$'}branchName.StartsWith('hotfix') ) { ${'$'}releaseLabel = 'beta' }
elseif ( ${'$'}branchName.StartsWith('tags') ) { ${'$'}releaseLabel = 'rtm' }
elseif ( ${'$'}branchName.StartsWith('proj') ) { ${'$'}releaseLabel = 'alpha' }
elseif ( ${'$'}branchName.StartsWith('bugfix') ) { ${'$'}releaseLabel = 'beta' }
elseif ( ${'$'}branchName.StartsWith('pull') ) { ${'$'}releaseLabel = 'pr' }
.\build.ps1 -CI -SkipUnitTest -ChocolateyBuild -BuildNumber %build.counter% -ReleaseLabel ${'$'}releaseLabel -BuildDate (Get-Date -Format "yyyyMMdd")
""".trimIndent()
Expand All @@ -73,7 +77,7 @@ object ChocolateyNugetClient : BuildType({
name = "Publish NuGet Packages"
scriptMode = script {
content = """
${'$'}files=Get-ChildItem "artifacts/nupkgs" | Where-Object {${'$'}_.Name -like "*.nupkg" -and ${'$'}_.Name -notlike "*symbols*" -and ${'$'}_.Name -notlike "*-beta.nupkg" -and ${'$'}_.Name -notlike "*-alpha.nupkg" -and ${'$'}_.Name -notlike "*-rc.nupkg" -and ${'$'}_.Name -notlike "*-rtm-*" -and ${'$'}_.Name -notlike "*-rc-*"}
${'$'}files=Get-ChildItem "artifacts/nupkgs" | Where-Object {${'$'}_.Name -like "*.nupkg" -and ${'$'}_.Name -notlike "*symbols*" -and ${'$'}_.Name -notlike "*-beta.nupkg" -and ${'$'}_.Name -notlike "*-alpha.nupkg" -and ${'$'}_.Name -notlike "*-rc.nupkg" -and ${'$'}_.Name -notlike "*-rtm-*" -and ${'$'}_.Name -notlike "*-rc-*" -and ${'$'}_.Name -notlike "*-pr.nupkg" -and ${'$'}_.Name -notlike "*-pr-*"}
foreach (${'$'}file in ${'$'}files) {
NuGet push -Source '%env.NUGETDEVPUSH_SOURCE%' -ApiKey '%env.NUGETDEVPUSH_API_KEY%' "${'$'}(${'$'}file.FullName)"
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ param (
[ValidateSet('debug', 'release')]
[Alias('c')]
[string]$Configuration,
[ValidatePattern('^(alpha|beta|final|preview|rc|release|rtm|xprivate|zlocal)([0-9]*)$')]
[ValidatePattern('^(alpha|beta|final|preview|pr|rc|release|rtm|xprivate|zlocal)([0-9]*)$')]
[Alias('l')]
[string]$ReleaseLabel = 'zlocal',
[Alias('n')]
Expand Down

0 comments on commit 57350b1

Please sign in to comment.