@@ -224,40 +224,42 @@ jobs:
224224 Write-Output "branchSafeName: $branchSafeName!"
225225 Write-Output "-------------------------------------------"
226226 Write-Output "::endgroup::"
227+
227228 # Ring Setup
228229 Write-Output "::group::Ring Control Setup"
229230 Write-Output "-------------------------------------------"
230231 Write-Output "Ring Control Setup"
231232 Write-Output "-------------------------------------------"
232233 $Ring = "${{ steps.RingDetection.outputs.Ring }}"
233234 $WingetApplicationId = "nkdagility.azure-devops-migration-tools"
234- $RunCodeRelease = 'false'
235- $RunDocsRelease = 'false'
235+
236236 switch ("${{ steps.RingDetection.outputs.Ring }}") {
237237 "Production" {
238238 $WingetApplicationId = "nkdagility.azure-devops-migration-tools";
239239 $AzureSitesEnvironment = ""
240- $RunRelease = 'true'
240+ # Production: Release app when ForceRelease OR src changed
241+ $RunRelease = ( ('${{ inputs.ForceRelease }}' -eq 'true' ) -or ('${{ steps.filter.outputs.src }}' -eq 'true') )
241242 }
242243 "Preview" {
243244 $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview";
244245 $AzureSitesEnvironment = "preview";
245- $RunRelease = ( ('${{ inputs.ForceRelease }}' -eq 'true' ) -or ('${{ steps.filter.outputs.src }}' -eq 'true') -or ('${{ steps.filter.outputs.docs }}' -eq 'true') )
246+ # Preview: Release app when ForceRelease OR src changed
247+ $RunRelease = ( ('${{ inputs.ForceRelease }}' -eq 'true' ) -or ('${{ steps.filter.outputs.src }}' -eq 'true') )
246248 }
247249 default {
248250 $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Canary";
249251 $AzureSitesEnvironment = "${{ steps.RingDetection.outputs.Ring }}-${{ github.event.pull_request.number }}".ToLower()
250252 $RunRelease = 'false'
251253 }
252254 }
255+
253256 Write-Output "We are running for the $Ring Ring!"
254257 echo "Ring=$Ring" >> $env:GITHUB_OUTPUT
255258 Write-Output "We are focused on Winget ID $WingetApplicationId!"
256259 echo "WingetApplicationId=$WingetApplicationId" >> $env:GITHUB_OUTPUT
257-
258260 Write-Output "We are running for the $AzureSitesEnvironment AzureSitesEnvironment!"
259261 echo "AzureSitesEnvironment=$AzureSitesEnvironment" >> $env:GITHUB_OUTPUT
260- Write-Output "RunRelease=$RunRelease"
262+ Write-Output "RunRelease=$RunRelease (App releases when ForceRelease OR src changed) "
261263 echo "RunRelease=$RunRelease" >> $env:GITHUB_OUTPUT
262264 Write-Output "-------------------------------------------"
263265 Write-Output "::endgroup::"
@@ -348,7 +350,8 @@ jobs:
348350 name : " Build, Test, Sonar Cloud Analysis, & Package"
349351 runs-on : windows-latest
350352 needs : Setup
351- if : ${{ success() && ( needs.Setup.outputs.HasChanged_src == 'true' || needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
353+ # Build app only when src has changed
354+ if : ${{ success() && needs.Setup.outputs.HasChanged_src == 'true' }}
352355 env :
353356 solution : ' **/*.sln'
354357 buildPlatform : ' Any CPU'
@@ -498,7 +501,8 @@ jobs:
498501 GitVersion_NuGetVersion : ${{ needs.Setup.outputs.GitVersion_NuGetVersion }}
499502 GitVersion_PreReleaseLabel : ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }}
500503 needs : [build, Setup, BuildDocs]
501- if : ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
504+ # Release app when RunRelease is true (ForceRelease OR src changed)
505+ if : ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
502506 steps :
503507 - uses : actions/download-artifact@v4
504508 with :
@@ -565,7 +569,8 @@ jobs:
565569 env :
566570 GitVersion_SemVer : ${{ needs.Setup.outputs.GitVersion_SemVer }}
567571 needs : [GitHubRelease, Setup]
568- if : ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
572+ # Only when app was released
573+ if : ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
569574 steps :
570575 - name : Create Deployment on elmah.io
571576 uses : elmahio/github-create-deployment-action@v1
@@ -580,7 +585,8 @@ jobs:
580585 name : " Release to Marketplace"
581586 runs-on : ubuntu-latest
582587 needs : [Setup, GitHubRelease]
583- if : ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring == 'Production' ) }}
588+ # Only release to marketplace when app was released and it's production
589+ if : ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' && needs.Setup.outputs.nkdAgility_Ring == 'Production' }}
584590 steps :
585591 - name : Checkout
586592 uses : actions/checkout@v4
@@ -609,7 +615,8 @@ jobs:
609615 name : " Release to Chocolatey"
610616 runs-on : windows-latest
611617 needs : [Setup, GitHubRelease]
612- if : ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
618+ # Only when app was released
619+ if : ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
613620 steps :
614621 - uses : actions/download-artifact@v4
615622 with :
@@ -633,7 +640,8 @@ jobs:
633640 name : " Release to Winget"
634641 runs-on : windows-latest
635642 needs : [Setup, GitHubRelease]
636- if : ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
643+ # Only when app was released
644+ if : ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
637645 steps :
638646 - name : Checkout
639647 uses : actions/checkout@v4
@@ -654,6 +662,7 @@ jobs:
654662 name : " Release to Docs"
655663 runs-on : ubuntu-latest
656664 needs : [Setup, BuildDocs]
665+ # Always deploy docs (as requested)
657666 if : ${{ !(github.event.pull_request.head.repo.fork) }}
658667 steps :
659668 - name : Download a single artifact
0 commit comments