-
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔧 (main.yml): add inputs for forced change detection and improve rele…
…ase conditions Add inputs to force the `src` and `docs` folders to be considered changed. Improve the release conditions by introducing a `RunRelease` flag to control when releases should be executed. This enhances the flexibility and control over the CI/CD pipeline, allowing for more granular and conditional execution based on specific folder changes or forced inputs. 🔧 (main.yml): update release conditions and simplify folder decision logic Simplifies the release condition by checking a single output variable `nkdAgility_RunRelease` instead of multiple conditions. Removes the redundant folder decision logic and directly uses the `nkdAgility_DocsDeployFolder` output for the SFTP upload path. This streamlines the workflow and reduces potential points of failure. ♻️ (TfsWorkItemEmbededLinkEnricher.cs, TfsWorkItemMigrationClient.cs, WorkItemMigrationClientMock.cs, IWorkItemMigrationClient.cs, WorkItemMigrationClientBase.cs): add stopOnError parameter to GetWorkItem methods Introduce a `stopOnError` parameter to the `GetWorkItem` methods to provide more control over error handling. This change allows the caller to decide whether the application should exit on error or continue execution. This improves the flexibility and robustness of the error handling mechanism in the work item migration process.
- Loading branch information
Showing
6 changed files
with
117 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,17 @@ on: | |
pull_request: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
inputs: | ||
ForceHasChanged_src: | ||
description: 'Force the src folder to be considered changed' | ||
required: false | ||
default: false | ||
type: boolean | ||
ForceHasChanged_docs: | ||
description: 'Force the docs folder to be considered changed' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
@@ -40,9 +51,14 @@ 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 }} | ||
nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -80,34 +96,57 @@ jobs: | |
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
# Ring Setup | ||
Write-Output "-------------------------------------------" | ||
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 }}' -eq 'true') -or ('${{ steps.filter.outputs.docs }}' -eq '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!" | ||
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 "RunRelease=$RunRelease" | ||
echo "RunRelease=$RunRelease" >> $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 }} | ||
|
@@ -122,7 +161,35 @@ 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 { | ||
if ('${{ inputs.ForceHasChanged_src }}' -eq 'true') { | ||
echo "HasChanged_src=true" >> $env:GITHUB_OUTPUT; | ||
} else { | ||
echo "HasChanged_src=false" >> $env:GITHUB_OUTPUT; | ||
} | ||
} | ||
if ('${{ steps.filter.outputs.docs }}' -eq 'true') { | ||
echo "HasChanged_docs=true" >> $env:GITHUB_OUTPUT; | ||
} else { | ||
if ('${{ inputs.ForceHasChanged_docs }}' -eq 'true') { | ||
echo "HasChanged_docs=true" >> $env:GITHUB_OUTPUT; | ||
} else { | ||
echo "HasChanged_docs=false" >> $env:GITHUB_OUTPUT; | ||
} | ||
} | ||
if ('${{ steps.filter.outputs.automation }}' -eq 'true') { | ||
echo "HasChanged_automation=true" >> $env:GITHUB_OUTPUT; | ||
} else { | ||
echo "HasChanged_automation=false" >> $env:GITHUB_OUTPUT; | ||
} | ||
Write-Output "-------------------------------------------" | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -144,10 +211,14 @@ 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}} | ||
- 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}} | ||
|
@@ -262,8 +333,13 @@ jobs: | |
- uses: cschleiden/replace-tokens@v1 | ||
with: | ||
files: '["**/*.html"]' | ||
tokenPrefix: "${" | ||
tokenSuffix: "}" | ||
tokenPrefix: "#{" | ||
tokenSuffix: "}#" | ||
env: | ||
GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} | ||
GitVersion_AssemblySemVer: ${{ needs.Setup.outputs.GitVersion_AssemblySemVer }} | ||
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} | ||
GitVersion.SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} | ||
- uses: igsekor/[email protected] | ||
id: spellcheck | ||
name: Spellcheck | ||
|
@@ -286,11 +362,8 @@ jobs: | |
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} | ||
GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} | ||
GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} | ||
HasChanged_src: ${{ needs.Setup.outputs.HasChanged_src }} | ||
HasChanged_docs: ${{ needs.Setup.outputs.HasChanged_docs }} | ||
HasChanged_automation: ${{ needs.Setup.outputs.HasChanged_automation }} | ||
needs: [build, Setup] | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && ( needs.Setup.outputs.HasChanged_src == 'true' ) }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -314,11 +387,7 @@ jobs: | |
run: | | ||
if ($Env:nkdAgility_Ring -eq 'Release') { | ||
echo "discussion_category_name=Anouncement" >> $env:GITHUB_OUTPUT | ||
} | ||
. .\build\include\Get-ReleaseDescription.ps1 | ||
$description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} | ||
echo "release_description=$description" >> $env:GITHUB_OUTPUT | ||
} | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
|
@@ -355,7 +424,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_RunRelease == 'true' ) }} | ||
steps: | ||
- name: Create Deployment on elmah.io | ||
uses: elmahio/github-create-deployment-action@v1 | ||
|
@@ -370,7 +439,7 @@ jobs: | |
name: "Release to Marketplace" | ||
runs-on: ubuntu-latest | ||
needs: [Setup, GitHubRelease] | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -399,7 +468,7 @@ jobs: | |
name: "Release to Chocolatey" | ||
runs-on: windows-latest | ||
needs: [Setup, GitHubRelease] | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -423,7 +492,7 @@ jobs: | |
name: "Release to Winget" | ||
runs-on: windows-latest | ||
needs: [Setup, GitHubRelease] | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -444,7 +513,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.HasChanged_docs == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- name: Download a single artifact | ||
uses: actions/download-artifact@v4 | ||
|
@@ -454,17 +523,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/[email protected] | ||
with: | ||
|
@@ -476,6 +535,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters