From 9b94cdc49167882424f667b86c271eba50853a51 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 13:53:57 +0100 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20steps?= =?UTF-8?q?=20to=20set=20documentation=20deployment=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add steps to set `docs_version_folder` and `docs_deploy_folder` variables for documentation deployment. This ensures that the documentation is deployed to the correct folder based on the version and ring environment. This change improves the automation process by dynamically setting the deployment paths, making the workflow more adaptable to different environments and versions. --- .github/workflows/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 95fb3950f..16dcbbd55 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -160,6 +160,20 @@ jobs: } else { echo "HasChanged_automation=false" >> $env:GITHUB_OUTPUT; } + # Get Variables for Docs + Write-Output "-------------------------------------------" + Write-Output "Get Variables for Docs" + Write-Output "-------------------------------------------" + $docs_version_folder = "/azure-devops-migration-tools/$Env:GitVersion_SemVer" + $docs_deploy_folder = "/azure-devops-migration-tools/" + if ($Env:nkdAgility_Ring -ne 'Release') { + $docs_deploy_folder = Join-Path -Path $docs_deploy_folder -ChildPath $Env:nkdAgility_Ring + } + Write-Output "docs_deploy_folder=$docs_deploy_folder" + echo "docs_deploy_folder=$docs_deploy_folder" >> $env:GITHUB_OUTPUT + Write-Output "docs_version_folder=$docs_version_folder" + echo "docs_version_folder=$docs_version_folder" >> $env:GITHUB_OUTPUT + Write-Output "-------------------------------------------" - uses: actions/upload-artifact@v4 with: From 7d6bc706651ec51acd9514b5641f1aa4e84ab49a Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:02:56 +0100 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20Git?= =?UTF-8?q?Hub=20Actions=20workflow=20to=20include=20new=20documentation?= =?UTF-8?q?=20paths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unused `IsBuildEditBranch` output and add new outputs for `docs_deploy_folder` and `docs_version_folder`. This change ensures that the documentation paths are correctly set up based on the release ring and version, improving the deployment process for documentation. --- .github/workflows/main.yml | 57 ++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16dcbbd55..cf56c812c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,12 +51,13 @@ jobs: HasChanged_automation: ${{ steps.filter.outputs.automation }} nkdAgility_Ring: ${{ steps.nkdagility.outputs.Ring }} nkdAgility_WingetApplicationId: ${{ steps.nkdagility.outputs.WingetApplicationId }} - nkdAgility_IsBuildEditBranch: ${{ steps.nkdagility.outputs.IsBuildEditBranch }} nkdAgility_ReleaseDescription: ${{ steps.nkdagility.outputs.release_description }} nkdAgility_ReleaseDescriptionState: ${{ steps.nkdagility.outputs.release_description_state }} nkdAgility_HasChanged_src: ${{ steps.nkdagility.outputs.HasChanged_src }} nkdAgility_HasChanged_docs: ${{ steps.nkdagility.outputs.HasChanged_docs }} nkdAgility_HasChanged_automation: ${{ steps.nkdagility.outputs.HasChanged_automation }} + nkdAgility_DocsDeployFolder: ${{ steps.nkdagility.outputs.docs_deploy_folder }} + nkdAgility_DocsVersionFolder: ${{ steps.nkdagility.outputs.docs_version_folder }} steps: - name: Checkout uses: actions/checkout@v2 @@ -94,34 +95,50 @@ jobs: env: GH_TOKEN: ${{ steps.app-token.outputs.token }} run: | + # Ring Setup + Write-Output "-------------------------------------------" + Write-Output "Ring Setup" + Write-Output "-------------------------------------------" $Ring = "Canary" $WingetApplicationId = "nkdagility.azure-devops-migration-tools" + $docs_deploy_folder = "/azure-devops-migration-tools/"; switch ($Env:GitVersion_PreReleaseLabel) { "" { $Ring = "Release"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools"; + $docs_deploy_folder = "/azure-devops-migration-tools/" } "Preview" { $Ring = "Preview"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview"; + $docs_deploy_folder = "/azure-devops-migration-tools/preview/"; } default { $Ring = "Canary"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Canary"; + $docs_deploy_folder = "/azure-devops-migration-tools/canary/" } } Write-Output "We are running for the $Ring Ring!" - Write-Output "We are focused on Winget ID $WingetApplicationId!" echo "Ring=$Ring" >> $env:GITHUB_OUTPUT + Write-Output "We are focused on Winget ID $WingetApplicationId!" echo "WingetApplicationId=$WingetApplicationId" >> $env:GITHUB_OUTPUT + Write-Output "docs_deploy_folder=$docs_deploy_folder" + echo "docs_deploy_folder=$docs_deploy_folder" >> $env:GITHUB_OUTPUT + Write-Output "-------------------------------------------" + # Docs Setup + Write-Output "-------------------------------------------" + Write-Output "Docs" + Write-Output "-------------------------------------------" + $docs_version_folder = "/azure-devops-migration-tools/$Env:GitVersion_SemVer" + Write-Output "docs_version_folder=$docs_version_folder" + echo "docs_version_folder=$docs_version_folder" >> $env:GITHUB_OUTPUT + Write-Output "-------------------------------------------" - $IsBuildEditBranch = $false; - if (("${{ github.ref_name }}").contains("build/")) { - $IsBuildEditBranch = $true; - } - Write-Output "IsBuildEditBranch=$IsBuildEditBranch" - echo "IsBuildEditBranch=$IsBuildEditBranch" >> $env:GITHUB_OUTPUT - + # Get-ReleaseDescription + Write-Output "-------------------------------------------" + Write-Output "Get-ReleaseDescription" + Write-Output "-------------------------------------------" Write-Output "Running Get-ReleaseDescription.ps1" . .\build\include\Get-ReleaseDescription.ps1 $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} @@ -136,7 +153,11 @@ jobs: echo "release_description<<$EOF" >> $env:GITHUB_OUTPUT echo $description >> $env:GITHUB_OUTPUT echo "$EOF" >> $env:GITHUB_OUTPUT - + Write-Output "-------------------------------------------" + # HasChanged Setup + Write-Output "-------------------------------------------" + Write-Output "HasChanged Setup" + Write-Output "-------------------------------------------" if ('${{ steps.filter.outputs.src }}' -eq 'true') { echo "HasChanged_src=true" >> $env:GITHUB_OUTPUT; } else { @@ -160,19 +181,6 @@ jobs: } else { echo "HasChanged_automation=false" >> $env:GITHUB_OUTPUT; } - # Get Variables for Docs - Write-Output "-------------------------------------------" - Write-Output "Get Variables for Docs" - Write-Output "-------------------------------------------" - $docs_version_folder = "/azure-devops-migration-tools/$Env:GitVersion_SemVer" - $docs_deploy_folder = "/azure-devops-migration-tools/" - if ($Env:nkdAgility_Ring -ne 'Release') { - $docs_deploy_folder = Join-Path -Path $docs_deploy_folder -ChildPath $Env:nkdAgility_Ring - } - Write-Output "docs_deploy_folder=$docs_deploy_folder" - echo "docs_deploy_folder=$docs_deploy_folder" >> $env:GITHUB_OUTPUT - Write-Output "docs_version_folder=$docs_version_folder" - echo "docs_version_folder=$docs_version_folder" >> $env:GITHUB_OUTPUT Write-Output "-------------------------------------------" - uses: actions/upload-artifact@v4 @@ -195,8 +203,9 @@ jobs: ## ${{needs.Setup.outputs.GitVersion_SemVer}} (${{needs.Setup.outputs.nkdAgility_Ring}}) ### NKDAgility - nkdAgility_Ring: ${{needs.Setup.outputs.nkdAgility_Ring}} - - nkdAgility_IsBuildEditBranch: ${{needs.Setup.outputs.nkdAgility_IsBuildEditBranch}} - nkdAgility_WingetApplicationId: ${{needs.Setup.outputs.nkdAgility_WingetApplicationId}} + - nkdAgility_DocsVersionFolder: ${{needs.Setup.outputs.nkdAgility_DocsVersionFolder}} + - nkdAgility_DocsDeployFolder: ${{needs.Setup.outputs.nkdAgility_DocsDeployFolder}} - nkdAgility_ReleaseDescriptionState: ${{needs.Setup.outputs.nkdAgility_ReleaseDescriptionState}} - nkdAgility_HasChanged_src: ${{needs.Setup.outputs.nkdAgility_HasChanged_src}} - nkdAgility_HasChanged_docs: ${{needs.Setup.outputs.nkdAgility_HasChanged_docs}} From 8f6da92b4d4e8232f850e90e67fb5a2f30b46ca6 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:09:16 +0100 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20doc?= =?UTF-8?q?s=5Fdeploy=5Ffolder=20paths=20and=20remove=20redundant=20Folder?= =?UTF-8?q?-Decision=20step?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change absolute paths to relative paths for docs_deploy_folder to ensure compatibility across different environments. Remove the redundant Folder-Decision step to streamline the workflow and avoid unnecessary complexity. This improves the maintainability and readability of the workflow configuration. --- .github/workflows/main.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf56c812c..d11dfd588 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,22 +101,22 @@ jobs: Write-Output "-------------------------------------------" $Ring = "Canary" $WingetApplicationId = "nkdagility.azure-devops-migration-tools" - $docs_deploy_folder = "/azure-devops-migration-tools/"; + $docs_deploy_folder = "./azure-devops-migration-tools/"; switch ($Env:GitVersion_PreReleaseLabel) { "" { $Ring = "Release"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools"; - $docs_deploy_folder = "/azure-devops-migration-tools/" + $docs_deploy_folder = "./azure-devops-migration-tools/" } "Preview" { $Ring = "Preview"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview"; - $docs_deploy_folder = "/azure-devops-migration-tools/preview/"; + $docs_deploy_folder = "./azure-devops-migration-tools/preview/"; } default { $Ring = "Canary"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Canary"; - $docs_deploy_folder = "/azure-devops-migration-tools/canary/" + $docs_deploy_folder = "./azure-devops-migration-tools/canary/" } } Write-Output "We are running for the $Ring Ring!" @@ -514,17 +514,7 @@ jobs: - name: "Find files" shell: pwsh run: | - Get-Item -Path .\ - - name: "Folder Desider" - id: Folder-Decision - shell: pwsh - run: | - if ($Env:nkdAgility_Ring -ne 'Release') { - echo "subfolder=$Env:nkdAgility_Ring" >> $env:GITHUB_OUTPUT - Write-Output "subfolder=$Env:nkdAgility_Ring" - } else { - Write-Output "subfolder=" - } + Get-Item -Path .\ - name: SFTP Upload ${{ (needs.Setup.outputs.nkdAgility_Ring) }} uses: Dylan700/sftp-upload-action@v1.1.4 with: @@ -536,6 +526,6 @@ jobs: dry-run: ${{ (needs.Setup.outputs.nkdAgility_Ring) == 'Canary' }} # A list of folders to upload in the format of `folder/ => upload_folder/` uploads: | - ./_site/ => ./azure-devops-migration-tools/${{ steps.Folder-Decision.outputs.subfolder }} + ./_site/ => ${{needs.Setup.outputs.nkdAgility_DocsDeployFolder}} # If true, any existing files in the remote upload directories are deleted. delete: false \ No newline at end of file From 11cfb70d9f9990789fc728b88a4fe039a4bdcf39 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:15:18 +0100 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20wor?= =?UTF-8?q?kflow=20conditions=20for=20better=20release=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the conditions in the GitHub Actions workflow to allow jobs to run for 'Preview' and 'Release' rings. This change ensures that jobs are executed not only when the ring is 'Release' but also when it is 'Preview' and the source has changed. This improves the flexibility and control over the deployment process, allowing for more granular release management. --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d11dfd588..dab489556 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -354,7 +354,7 @@ jobs: GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} needs: [build, Setup] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && ( needs.Setup.outputs.nkdAgility_HasChanged_src == 'true' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -415,7 +415,7 @@ jobs: env: GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} needs: [GitHubRelease, Setup] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - name: Create Deployment on elmah.io uses: elmahio/github-create-deployment-action@v1 @@ -430,7 +430,7 @@ jobs: name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -459,7 +459,7 @@ jobs: name: "Release to Chocolatey" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -483,7 +483,7 @@ jobs: name: "Release to Winget" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -504,7 +504,7 @@ jobs: name: "Release to Docs" runs-on: ubuntu-latest needs: [Setup, BuildDocs, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - name: Download a single artifact uses: actions/download-artifact@v4 From 413dcb381d4aadb81390694a252a3fee5f47fc81 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:16:49 +0100 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20fix=20condit?= =?UTF-8?q?ional=20check=20for=20nkdAgility=5FRing=20to=20use=20'=3D=3D'?= =?UTF-8?q?=20instead=20of=20'=3D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The conditional checks for `nkdAgility_Ring` in the GitHub Actions workflow are corrected to use `==` for comparison instead of `=`. This ensures proper evaluation of the conditions, allowing the workflow to execute correctly based on the ring type. --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dab489556..26830a655 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -354,7 +354,7 @@ jobs: GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} needs: [build, Setup] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -415,7 +415,7 @@ jobs: env: GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} needs: [GitHubRelease, Setup] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Create Deployment on elmah.io uses: elmahio/github-create-deployment-action@v1 @@ -430,7 +430,7 @@ jobs: name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -459,7 +459,7 @@ jobs: name: "Release to Chocolatey" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -504,7 +504,7 @@ jobs: name: "Release to Docs" runs-on: ubuntu-latest needs: [Setup, BuildDocs, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Download a single artifact uses: actions/download-artifact@v4 From 47b30b7bec4fd79da096aa5ff08e3a4550384194 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:17:59 +0100 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20fix=20condit?= =?UTF-8?q?ional=20expressions=20in=20GitHub=20Actions=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrects the conditional expressions in the GitHub Actions workflow by changing assignment operators (`=`) to equality operators (`==`). This ensures the conditions are evaluated correctly, preventing unintended behavior during workflow execution. --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26830a655..04e421459 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -354,7 +354,7 @@ jobs: GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} needs: [build, Setup] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -415,7 +415,7 @@ jobs: env: GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} needs: [GitHubRelease, Setup] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Create Deployment on elmah.io uses: elmahio/github-create-deployment-action@v1 @@ -430,7 +430,7 @@ jobs: name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -459,7 +459,7 @@ jobs: name: "Release to Chocolatey" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -483,7 +483,7 @@ jobs: name: "Release to Winget" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -504,7 +504,7 @@ jobs: name: "Release to Docs" runs-on: ubuntu-latest needs: [Setup, BuildDocs, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring = 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Download a single artifact uses: actions/download-artifact@v4 From db97026081db30a8b5b4a1c919b770c9b3704f77 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:19:12 +0100 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20fix=20condit?= =?UTF-8?q?ional=20expression=20for=20Winget=20release=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrects the conditional expression in the GitHub Actions workflow to ensure proper evaluation. The previous expression had a single equals sign (`=`) instead of a double equals sign (`==`) for comparison, which could lead to incorrect job execution. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04e421459..21201b76e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -483,7 +483,7 @@ jobs: name: "Release to Winget" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring = 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 From 9d89959a8df67a58dd87affad31a8a1b3d1d4add Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:31:46 +0100 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20`RunRe?= =?UTF-8?q?lease`=20output=20to=20control=20release=20steps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a new `RunRelease` output to streamline the release process. This change ensures that the release steps are only executed when necessary, based on the `RunRelease` flag. This improves the workflow by making it more efficient and reducing unnecessary steps, especially for non-release branches. --- .github/workflows/main.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 21201b76e..de4334690 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,6 +58,7 @@ jobs: nkdAgility_HasChanged_automation: ${{ steps.nkdagility.outputs.HasChanged_automation }} nkdAgility_DocsDeployFolder: ${{ steps.nkdagility.outputs.docs_deploy_folder }} nkdAgility_DocsVersionFolder: ${{ steps.nkdagility.outputs.docs_version_folder }} + nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }} steps: - name: Checkout uses: actions/checkout@v2 @@ -97,26 +98,31 @@ jobs: run: | # Ring Setup Write-Output "-------------------------------------------" - Write-Output "Ring Setup" + Write-Output "Ring Control Setup" Write-Output "-------------------------------------------" $Ring = "Canary" $WingetApplicationId = "nkdagility.azure-devops-migration-tools" $docs_deploy_folder = "./azure-devops-migration-tools/"; + $RunCodeRelease = 'false' + $RunDocsRelease = 'false' switch ($Env:GitVersion_PreReleaseLabel) { "" { $Ring = "Release"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools"; $docs_deploy_folder = "./azure-devops-migration-tools/" + $RunRelease = 'true' } "Preview" { $Ring = "Preview"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview"; $docs_deploy_folder = "./azure-devops-migration-tools/preview/"; + $RunRelease = ('${{ steps.filter.outputs.src }}' == 'true') } default { $Ring = "Canary"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Canary"; $docs_deploy_folder = "./azure-devops-migration-tools/canary/" + $RunRelease = 'false' } } Write-Output "We are running for the $Ring Ring!" @@ -125,6 +131,8 @@ jobs: echo "WingetApplicationId=$WingetApplicationId" >> $env:GITHUB_OUTPUT Write-Output "docs_deploy_folder=$docs_deploy_folder" echo "docs_deploy_folder=$docs_deploy_folder" >> $env:GITHUB_OUTPUT + Write-Output "RunRelease=$RunRelease" + echo "RunRelease=$RunRelease" >> $env:GITHUB_OUTPUT Write-Output "-------------------------------------------" # Docs Setup Write-Output "-------------------------------------------" @@ -210,6 +218,7 @@ jobs: - nkdAgility_HasChanged_src: ${{needs.Setup.outputs.nkdAgility_HasChanged_src}} - nkdAgility_HasChanged_docs: ${{needs.Setup.outputs.nkdAgility_HasChanged_docs}} - nkdAgility_HasChanged_automation: ${{needs.Setup.outputs.nkdAgility_HasChanged_automation}} + - nkdAgility_RunRelease: ${{needs.Setup.outputs.nkdAgility_RunRelease}} ### GitVersion - GitVersion_BranchName: ${{needs.Setup.outputs.GitVersion_BranchName}} - GitVersion_SemVer: ${{needs.Setup.outputs.GitVersion_SemVer}} @@ -354,7 +363,7 @@ jobs: GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} needs: [build, Setup] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -415,7 +424,7 @@ jobs: env: GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} needs: [GitHubRelease, Setup] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} steps: - name: Create Deployment on elmah.io uses: elmahio/github-create-deployment-action@v1 @@ -430,7 +439,7 @@ jobs: name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -459,7 +468,7 @@ jobs: name: "Release to Chocolatey" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -483,7 +492,7 @@ jobs: name: "Release to Winget" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -504,7 +513,7 @@ jobs: name: "Release to Docs" runs-on: ubuntu-latest needs: [Setup, BuildDocs, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Preview' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') ) || ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} steps: - name: Download a single artifact uses: actions/download-artifact@v4 From 0570253bbb19e459b7366d6699616524169b766b Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:33:52 +0100 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20fix=20syntax?= =?UTF-8?q?=20error=20in=20GitHub=20Actions=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove an extra parenthesis in the conditional statement to ensure the workflow runs correctly. The previous syntax error could prevent the "Release to Marketplace" job from executing as intended. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index de4334690..ade76f6c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -439,7 +439,7 @@ jobs: name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} steps: - name: Checkout uses: actions/checkout@v2 From a18ac37fa401daaa86a94f95ae28793434378b21 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 14:36:05 +0100 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20correct=20co?= =?UTF-8?q?mparison=20operator=20in=20PowerShell=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comparison operator in the PowerShell script is changed from '==' to '-eq' to ensure proper evaluation of the condition. This change is necessary because '==' is not a valid comparison operator in PowerShell, and using '-eq' ensures the script runs correctly. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ade76f6c0..17b0dfa38 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -116,7 +116,7 @@ jobs: $Ring = "Preview"; $WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview"; $docs_deploy_folder = "./azure-devops-migration-tools/preview/"; - $RunRelease = ('${{ steps.filter.outputs.src }}' == 'true') + $RunRelease = ('${{ steps.filter.outputs.src }}' -eq 'true') } default { $Ring = "Canary";