-
-
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.
- Loading branch information
Showing
1 changed file
with
51 additions
and
29 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 |
---|---|---|
|
@@ -51,12 +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 | ||
|
@@ -94,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') | ||
} | ||
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 }} | ||
|
@@ -136,7 +161,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,6 +189,7 @@ jobs: | |
} else { | ||
echo "HasChanged_automation=false" >> $env:GITHUB_OUTPUT; | ||
} | ||
Write-Output "-------------------------------------------" | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -181,12 +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}} | ||
|
@@ -331,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 != 'Canary' ) && ( needs.Setup.outputs.nkdAgility_HasChanged_src == 'true' ) }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -392,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 | ||
|
@@ -407,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.nkdAgility_HasChanged_src == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring == 'Release' ) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -436,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.nkdAgility_HasChanged_src == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
|
@@ -460,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.nkdAgility_HasChanged_src == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -481,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.nkdAgility_HasChanged_docs == 'true') }} | ||
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }} | ||
steps: | ||
- name: Download a single artifact | ||
uses: actions/download-artifact@v4 | ||
|
@@ -491,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: | ||
|
@@ -513,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 |