Skip to content

Commit de78372

Browse files
authored
Merge branch 'main' into update-to-home-title
2 parents 90424f4 + c291def commit de78372

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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,9 @@ 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' || needs.Setup.outputs.HasChanged_automation == 'true') }}
355+
352356
env:
353357
solution: '**/*.sln'
354358
buildPlatform: 'Any CPU'
@@ -498,7 +502,8 @@ jobs:
498502
GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }}
499503
GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }}
500504
needs: [build, Setup, BuildDocs]
501-
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
505+
# Release app when RunRelease is true (ForceRelease OR src changed)
506+
if: ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
502507
steps:
503508
- uses: actions/download-artifact@v4
504509
with:
@@ -565,7 +570,8 @@ jobs:
565570
env:
566571
GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }}
567572
needs: [GitHubRelease, Setup]
568-
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
573+
# Only when app was released
574+
if: ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
569575
steps:
570576
- name: Create Deployment on elmah.io
571577
uses: elmahio/github-create-deployment-action@v1
@@ -580,7 +586,8 @@ jobs:
580586
name: "Release to Marketplace"
581587
runs-on: ubuntu-latest
582588
needs: [Setup, GitHubRelease]
583-
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring == 'Production' ) }}
589+
# Only release to marketplace when app was released and it's production
590+
if: ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' && needs.Setup.outputs.nkdAgility_Ring == 'Production' }}
584591
steps:
585592
- name: Checkout
586593
uses: actions/checkout@v4
@@ -609,7 +616,8 @@ jobs:
609616
name: "Release to Chocolatey"
610617
runs-on: windows-latest
611618
needs: [Setup, GitHubRelease]
612-
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
619+
# Only when app was released
620+
if: ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
613621
steps:
614622
- uses: actions/download-artifact@v4
615623
with:
@@ -633,7 +641,8 @@ jobs:
633641
name: "Release to Winget"
634642
runs-on: windows-latest
635643
needs: [Setup, GitHubRelease]
636-
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
644+
# Only when app was released
645+
if: ${{ success() && needs.Setup.outputs.nkdAgility_RunRelease == 'true' }}
637646
steps:
638647
- name: Checkout
639648
uses: actions/checkout@v4
@@ -654,6 +663,7 @@ jobs:
654663
name: "Release to Docs"
655664
runs-on: ubuntu-latest
656665
needs: [Setup, BuildDocs]
666+
# Always deploy docs (as requested)
657667
if: ${{ !(github.event.pull_request.head.repo.fork) }}
658668
steps:
659669
- name: Download a single artifact

0 commit comments

Comments
 (0)