diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml new file mode 100644 index 000000000..a03544cd2 --- /dev/null +++ b/.github/workflows/code-review.yml @@ -0,0 +1,21 @@ +name: Code Review + +permissions: + contents: read + pull-requests: write + +on: + pull_request: + types: [opened, reopened] + +jobs: + code-review: + runs-on: ubuntu-latest + steps: + - uses: fitomad/github-chatgpt-integration@main + with: + openai-api-key: ${{ secrets.OPENAI_API_KEY }} + github-token: ${{ secrets.GH_TOKEN }} + github-pr-id: ${{ github.event.number }} + dev-lang: c# + openai-max-tokens: 4096 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d50e152d..be1466f33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,12 @@ name: Build & Release (Azure DevOps Migration Tools) +permissions: + contents: read + pull-requests: write + on: push: branches: - - '*' tags-ignore: - 'v*-*' pull_request: @@ -19,6 +22,10 @@ env: APP_ID: "Iv23li9aYvt0VW9x4Jhh" PRIVATE_KEY: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} +defaults: + run: + shell: pwsh + jobs: # Setup & Configuration @@ -32,10 +39,13 @@ jobs: GitVersion_AssemblySemVer: ${{ steps.gitversion.outputs.GitVersion_AssemblySemVer }} GitVersion_InformationalVersion: ${{ steps.gitversion.outputs.GitVersion_InformationalVersion }} GitVersion_NuGetVersion: ${{ steps.gitversion.outputs.GitVersion_NuGetVersion }} - Filter_src: ${{ steps.filter.outputs.src }} - Filter_docs: ${{ steps.filter.outputs.docs }} - Filter_automation: ${{ steps.filter.outputs.automation }} - nkdAgility_Ring: ${{ steps.nkdagility-outputs.outputs.Ring }} + GitVersion_PreReleaseNumber: ${{ steps.gitversion.outputs.GitVersion_PreReleaseNumber }} + GitVersion_MajorMinorPatch: ${{ steps.gitversion.outputs.GitVersion_MajorMinorPatch }} + HasChanged_src: ${{ steps.filter.outputs.src }} + HasChanged_docs: ${{ steps.filter.outputs.docs }} + HasChanged_automation: ${{ steps.filter.outputs.automation }} + nkdAgility_Ring: ${{ steps.nkdagility.outputs.Ring }} + nkdAgility_IsBuildEditBranch: ${{ steps.nkdagility.outputs.IsBuildEditBranch }} steps: - name: Checkout uses: actions/checkout@v2 @@ -64,7 +74,7 @@ jobs: - '.github/workflows/**' - name: "Build NKDAgility Outputs" shell: pwsh - id: nkdagility-outputs + id: nkdagility run: | $Ring = "Canary" switch ($Env:GitVersion_PreReleaseLabel) { @@ -79,50 +89,64 @@ jobs: } } Write-Output "We are running for the $Ring Ring!" - echo "Ring=$Ring" >> $env:GITHUB_OUTPUT + echo "Ring=$Ring" >> $env:GITHUB_OUTPUT + + $IsBuildEditBranch = $false; + if (("${{ github.ref_name }}").contains("build/")) { + $IsBuildEditBranch = $true; + } + Write-Output "IsBuildEditBranch=$IsBuildEditBranch" + echo "IsBuildEditBranch=$IsBuildEditBranch" >> $env:GITHUB_OUTPUT # Setup Validator - SetupValidatorStage: - name: "Setup Validator" + SetupSummeryStage: + name: "Build Run Data" runs-on: ubuntu-latest needs: Setup steps: - - name: "Release WorkItemClone" - shell: pwsh - run: | - Write-Output "GitVersion_BranchName: ${{needs.Setup.outputs.GitVersion_BranchName}}" - Write-Output "GitVersion_SemVer: ${{needs.Setup.outputs.GitVersion_SemVer}}" - Write-Output "GitVersion_PreReleaseLabel: ${{needs.Setup.outputs.GitVersion_PreReleaseLabel}}" - Write-Output "GitVersion_AssemblySemVer: ${{needs.Setup.outputs.GitVersion_AssemblySemVer}}" - Write-Output "GitVersion_InformationalVersion: ${{needs.Setup.outputs.GitVersion_InformationalVersion}}" - Write-Output "GitVersion_NuGetVersion: ${{needs.Setup.outputs.GitVersion_NuGetVersion}}" - Write-Output "Filter_src: ${{needs.Setup.outputs.Filter_src}}" - Write-Output "Filter_docs: ${{needs.Setup.outputs.Filter_docs}}" - Write-Output "Filter_automation: ${{needs.Setup.outputs.Filter_automation}}" - Write-Output "nkdAgility_Ring: ${{needs.Setup.outputs.nkdAgility_Ring}}" + - name: "Create Summery" + if: always() + shell: pwsh + id: nkdagility-summery + run: | + $markdown = @" + ## ${{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}} + ### GitVersion + - GitVersion_BranchName: ${{needs.Setup.outputs.GitVersion_BranchName}} + - GitVersion_SemVer: ${{needs.Setup.outputs.GitVersion_SemVer}} + - GitVersion_PreReleaseLabel: ${{needs.Setup.outputs.GitVersion_PreReleaseLabel}} + - GitVersion_AssemblySemVer: ${{needs.Setup.outputs.GitVersion_AssemblySemVer}} + - GitVersion_InformationalVersion: ${{needs.Setup.outputs.GitVersion_InformationalVersion}} + - GitVersion_NuGetVersion: ${{needs.Setup.outputs.GitVersion_NuGetVersion}} + ### Has Changed + - HasChanged_src: ${{needs.Setup.outputs.HasChanged_src}} + - HasChanged_docs: ${{needs.Setup.outputs.HasChanged_docs}} + - HasChanged_automation: ${{needs.Setup.outputs.HasChanged_automation}} + "@ + echo $markdown >> $Env:GITHUB_STEP_SUMMARY # Build, Test, Sonar Cloud Analysis, & Package build: name: "Build, Test, Sonar Cloud Analysis, & Package" runs-on: windows-latest needs: Setup - if: ${{ needs.Setup.outputs.Filter_src }} + if: ${{ needs.Setup.outputs.HasChanged_src }} env: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' - GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} + nkdAgility_Ring: ${{ needs.Setup.outputs.nkdAgility_Ring }} + GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} GitVersion_AssemblySemVer: ${{ needs.Setup.outputs.GitVersion_AssemblySemVer }} GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} + GitVersion_PreReleaseNumber: ${{ needs.Setup.outputs.GitVersion_PreReleaseNumber }} + GitVersion_MajorMinorPatch: ${{ needs.Setup.outputs.GitVersion_MajorMinorPatch }} steps: - # - name: Setup NuGet - # uses: NuGet/setup-nuget@v1.0.2 - # - name: Restore NuGet Packages - # run: nuget restore MigrationTools.sln - # - name: Build and Publish Web App - # run: msbuild MigrationTools.sln - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -135,6 +159,10 @@ jobs: files: '["**/StaticVariables.cs"]' tokenPrefix: "${" tokenSuffix: "}" + - uses: actions/upload-artifact@v4 + with: + name: AzureDevOpsMigrationTools-BuildScripts + path: ./build/** - name: Setup .NET uses: actions/setup-dotnet@v1 with: @@ -175,7 +203,7 @@ jobs: shell: pwsh if: ${{ steps.Build.outcome == 'success' }} run: | - .\build\packageExtension.ps1 -version ${{ env.GitVersion_AssemblySemVer }} -outfolder "./staging" + .\build\packageExtension.ps1 -version ${{ env.GitVersion_MajorMinorPatch }}.${{ env.GitVersion_PreReleaseNumber }} -outfolder "./staging" - name: "List Package Files" shell: pwsh if: ${{ steps.Build.outcome == 'success' }} @@ -186,6 +214,25 @@ jobs: name: AzureDevOpsMigrationTools-Packages path: ./staging/** + # Code Review + code-review: + name: "Code Review Bot " + runs-on: ubuntu-latest + needs: [Setup] + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ env.APP_ID }} + private-key: ${{ env.PRIVATE_KEY }} + - uses: fitomad/github-chatgpt-integration@main + with: + openai-api-key: ${{ secrets.OPENAI_API_KEY }} + github-token: ${{ steps.app-token.outputs.token }} + github-pr-id: ${{ github.event.number }} + dev-lang: c# + openai-max-tokens: 4096 + # Build Docs BuildDocs: name: "Build Documentation output" @@ -211,21 +258,21 @@ jobs: with: name: AzureDevOpsMigrationTools-Site path: ./_site/**/* - + # GitHubRelease GitHubRelease: - name: "Release to GitHub Releases (Not Migrated)" + name: "Release to GitHub Releases" runs-on: ubuntu-latest - if: ${{ needs.Setup.outputs.Filter_src }} env: + nkdAgility_Ring: ${{ needs.Setup.outputs.nkdAgility_Ring }} GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} GitVersion_AssemblySemVer: ${{ needs.Setup.outputs.GitVersion_AssemblySemVer }} GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} 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' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -239,8 +286,14 @@ jobs: shell: pwsh run: | Get-ChildItem -Path .\ -Recurse | ForEach-Object { $_.FullName } + - name: "Release options" + id: release-options + shell: pwsh + run: | + if ($Env:nkdAgility_Ring -ne 'Canary') { + echo "discussion_category_name=Anouncement" >> $env:GITHUB_OUTPUT + } - name: Release - if: ${{ false }} uses: softprops/action-gh-release@v2 with: files: | @@ -249,72 +302,112 @@ jobs: vsts-sync-migrator.*.nupkg generate_release_notes: true tag_name: v${{ needs.Setup.outputs.GitVersion_SemVer }} - name: Azure DevOps Migration Tools v${{ needs.Setup.outputs.GitVersion_SemVer }} + name: v${{ needs.Setup.outputs.GitVersion_SemVer }} (${{ needs.Setup.outputs.nkdAgility_Ring }}) token: ${{ steps.app-token.outputs.token }} - prerelease: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel == 'Preview' }} - discussion_category_name: "Anouncement" + prerelease: ${{ needs.Setup.outputs.nkdAgility_Ring != 'Release' }} + discussion_category_name: ${{ steps.release-options.outputs.discussion_category_name }} + draft: ${{ needs.Setup.outputs.nkdAgility_Ring == 'Canary' }} +# ElmahDeployment + ElmahDeployemnt: + name: "Create Elmah.io Deployment" + runs-on: ubuntu-latest + env: + GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} + needs: [GitHubRelease, Setup] + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} + steps: + - name: Create Deployment on elmah.io + uses: elmahio/github-create-deployment-action@v1 + with: + apiKey: ${{ secrets.ELMAH_IO_API_KEY }} + version: ${{ needs.Setup.outputs.GitVersion_SemVer }} + logId: ${{ secrets.ELMAH_IO_LOG_ID }} + + # Release to Marketplace MarketplaceRelease: - name: "Release to Marketplace (Not Migrated)" + name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ (needs.Setup.outputs.Filter_src) && (false) }} - #if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.Filter_src) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src) }} steps: + - name: Checkout + uses: actions/checkout@v2 - uses: actions/download-artifact@v4 - with: - name: AzureDevOpsMigrationTools-Packages - - name: "Find solution files" + - name: "Find files" shell: pwsh run: | - Get-Item -Path .\ - Get-ChildItem -Path .\ -Recurse -Filter '*.sln' | ForEach-Object { $_.FullName } + Get-Item -Path .\ + Write-Output "Build Files" + Get-ChildItem -Path .\ -Recurse -Filter '*.ps1' | ForEach-Object { $_.FullName } + - name: "Marketplace" + shell: pwsh + run: | + $vsixFile = Get-ChildItem -Path .\ -Recurse -Filter '*.vsix' + if ($vsixFile -eq $null) { + Write-Output "No VSIX file found" + exit 1 + } else { + Write-Output $"Running with {$vsixFile}" + } + .\build\releaseExtension.ps1 -vsixFile $vsixFile.FullName -marketplaceToken ${{ secrets.VS_MARKET_TOKEN }} + # Release to Chocolatey ChocolateyRelease: - name: "Release to Chocolatey (Not Migrated)" - runs-on: ubuntu-latest + name: "Release to Chocolatey" + runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ (needs.Setup.outputs.Filter_src) && (false) }} - #if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.Filter_src) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src) }} steps: - uses: actions/download-artifact@v4 with: name: AzureDevOpsMigrationTools-Packages - - name: "Find solution files" + - name: "Choco" shell: pwsh run: | - Get-Item -Path .\ - Get-ChildItem -Path .\ -Recurse -Filter '*.sln' | ForEach-Object { $_.FullName } + $chocoFile = Get-ChildItem -Path .\ -Recurse -Filter 'vsts-sync-migrator.${{ needs.Setup.outputs.GitVersion_NuGetVersion }}.nupkg' + if ($chocoFile -eq $null) { + Write-Output "No Choco file found" + exit 1 + } else { + Write-Output $"Running with {$chocoFile}" + } + + choco push $chocoFile.FullName --version $NuGetVersion --key ${{ secrets.CHOCO_APIKEY }} --source https://push.chocolatey.org/ + # Release to Winget WingetRelease: - name: "Release to Winget (Not Migrated)" + name: "Release to Winget" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ (needs.Setup.outputs.Filter_src) && (false) }} - #if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.Filter_src) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src) }} steps: + - name: Checkout + uses: actions/checkout@v2 - uses: actions/download-artifact@v4 - with: - name: AzureDevOpsMigrationTools-Packages - - name: "Find solution files" + - name: "Find files" shell: pwsh run: | - Get-Item -Path .\ - Get-ChildItem -Path .\ -Recurse -Filter '*.sln' | ForEach-Object { $_.FullName } + Get-Item -Path .\ + Write-Output "Build Files" + Get-ChildItem -Path .\ -Recurse -Filter '*.ps1' | ForEach-Object { $_.FullName } + - name: "Winget Release" + shell: pwsh + run: | + .\build\releaseWingetPackage.ps1 -version ${{ needs.Setup.outputs.GitVersion_SemVer }} -ring ${{needs.Setup.outputs.nkdAgility_Ring}} -GH_TOKEN ${{ secrets.GITHUB_TOKEN }} # Release to Docs DocsRelease: name: "Release to Docs" runs-on: ubuntu-latest - needs: [BuildDocs, GitHubRelease] - if: ${{ (needs.Setup.outputs.Filter_docs) && (false) }} - #if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} + needs: [Setup, BuildDocs, GitHubRelease] + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} steps: - name: Download a single artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: AzureDevOpsMigrationTools-Site path: ./_site @@ -322,19 +415,27 @@ jobs: shell: pwsh run: | Get-Item -Path .\ - - name: SFTP Upload - # You may pin to the exact commit or the version. - # uses: Dylan700/sftp-upload-action@f90db607d9fe1acdc0eefccee84d37c119b268fe + - 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=" + } + - name: SFTP Upload ${{ (needs.Setup.outputs.nkdAgility_Ring) }} uses: Dylan700/sftp-upload-action@v1.1.4 with: server: nakedalmweb.sftp.wpengine.com username: nakedalmweb-learn - password: ${{ secrets.SFTP_PASSWORD }} + password: ${{ secrets.NKDAGILITY_LEARN_SFTP }} port: 2222 # If true, outputs the results of the upload, without actually uploading. - dry-run: false + 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 + ./_site/ => ./azure-devops-migration-tools/${{ steps.Folder-Decision.outputs.subfolder }} # If true, any existing files in the remote upload directories are deleted. delete: false \ No newline at end of file diff --git a/.github/workflows/opencommit.yml b/.github/workflows/opencommit.yml new file mode 100644 index 000000000..5d015abac --- /dev/null +++ b/.github/workflows/opencommit.yml @@ -0,0 +1,46 @@ +name: 'OpenCommit AI' + +permissions: + contents: write + pull-requests: write + +on: + push: + # this list of branches is often enough, + # but you may still ignore other public branches + branches-ignore: [main master dev development release] + workflow_dispatch: + +jobs: + opencommit: + timeout-minutes: 10 + name: OpenCommit + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Setup Node.js Environment + uses: actions/setup-node@v2 + with: + node-version: '16' + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: di-sukharev/opencommit@github-action-v1.0.4 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + env: + # set openAI api key in repo actions secrets, + # for openAI keys go to: https://platform.openai.com/account/api-keys + # for repo secret go to: /settings/secrets/actions + OCO_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + + # customization + OCO_TOKENS_MAX_INPUT: 1100 + OCO_TOKENS_MAX_OUTPUT: 500 + OCO_OPENAI_BASE_PATH: '' + OCO_DESCRIPTION: false + OCO_EMOJI: false + OCO_MODEL: gpt-4 + OCO_LANGUAGE: en + OCO_PROMPT_MODULE: conventional-commit \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ff50fbee3..0d901f27f 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -17,6 +17,6 @@ jobs: stale-pr-label: 'no-pr-activity' stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days' stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days' - days-before-stale: 30 - days-before-close: 10 + days-before-stale: 90 + days-before-close: 30 exempt-issue-label: 'enhancement' diff --git a/GitVersion.yml b/GitVersion.yml index b2456bec1..a02d9e2c4 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,6 +1,6 @@ assembly-versioning-scheme: MajorMinorPatch mode: ContinuousDelivery -continuous-delivery-fallback-tag: '' +continuous-delivery-fallback-tag: 'Canary' next-version: 15.0.1 branches: main: diff --git a/MigrationTools.sln b/MigrationTools.sln index 378b54de0..3852462fd 100644 --- a/MigrationTools.sln +++ b/MigrationTools.sln @@ -90,7 +90,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MigrationTools.TestExtensio EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".workflows", ".workflows", "{8A70932A-F6C7-45D1-8E72-608B6BF0F9FD}" ProjectSection(SolutionItems) = preProject + .github\workflows\code-review.yml = .github\workflows\code-review.yml .github\workflows\main.yml = .github\workflows\main.yml + .github\workflows\opencommit.yml = .github\workflows\opencommit.yml + .github\workflows\stale.yml = .github\workflows\stale.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MigrationTools.ConsoleDataGenerator", "src\MigrationTools.ConsoleDataGenerator\MigrationTools.ConsoleDataGenerator.csproj", "{6A259EA6-860B-448A-8943-594DC1A15105}" @@ -113,6 +116,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{88C358 build\packageExtension.ps1 = build\packageExtension.ps1 build\packageNuget.ps1 = build\packageNuget.ps1 build\packageWinget.ps1 = build\packageWinget.ps1 + build\releaseExtension.ps1 = build\releaseExtension.ps1 build\releaseGitHubRelease.ps1 = build\releaseGitHubRelease.ps1 build\releaseWingetPackage.ps1 = build\releaseWingetPackage.ps1 build\versioning.ps1 = build\versioning.ps1 diff --git a/build/azure-pipeline.yml b/build/azure-pipeline.yml index 6d3a2bbc2..199bb49d6 100644 --- a/build/azure-pipeline.yml +++ b/build/azure-pipeline.yml @@ -486,6 +486,7 @@ stages: version: v0.7.x - task: ms-devlabs.vsts-developer-tools-build-tasks.publish-extension-build-task.PublishAzureDevOpsExtension@4 displayName: 'Publish Extension' + condition: and(succeeded(), ne(variables['nkdAgility_Ring'], "Canary")) inputs: connectedServiceName: 'nkdAgility-Marketplace' fileType: vsix @@ -518,6 +519,7 @@ stages: downloadPath: '$(System.ArtifactsDirectory)' - task: NuGetCommand@2 displayName: 'NuGet push' + condition: and(succeeded(), ne(variables['nkdAgility_Ring'], "Canary")) inputs: command: push packagesToPush: '$(System.ArtifactsDirectory)\**\*vsts-sync-migrator.*.nupkg' @@ -550,9 +552,10 @@ stages: downloadPath: '$(System.ArtifactsDirectory)' - task: PowerShell@2 displayName: Create Winget Release + condition: and(succeeded(), ne(variables['nkdAgility_Ring'], "Canary")) inputs: filePath: 'build/releaseWingetPackage.ps1' - arguments: '-version $(GitVersion.SemVer) -releaseTag $(releaseTag) -GH_TOKEN $(GH_TOKEN)' + arguments: '-version $(GitVersion.SemVer) -ring $(nkdAgility_Ring) -GH_TOKEN $(GH_TOKEN)' # Documentation release Stage - stage: DocsReleaseStage @@ -603,7 +606,7 @@ stages: Write-Host "Remote Path: $remoteDirectory" Write-Host "##vso[task.setvariable variable=remoteDirectory;isOutput=true]$remoteDirectory" - task: CopyFilesOverSSH@0 - condition: and(succeeded(), ne(dependencies.SetupStage.outputs['ConfigJob.VersionOut.nkdAgility_Ring'], "Canary")) + condition: and(succeeded(), ne(variables['nkdAgility_Ring'], "Canary")) inputs: sshEndpoint: 'nakedalmweb-learn' sourceFolder: '$(System.ArtifactsDirectory)/site' diff --git a/build/releaseExtension.ps1 b/build/releaseExtension.ps1 new file mode 100644 index 000000000..02902b4c0 --- /dev/null +++ b/build/releaseExtension.ps1 @@ -0,0 +1,30 @@ +<# + Script description. + + Some notes. +#> +param ( + # name of the output folder + [Parameter(Mandatory=$true)] + [string]$vsixFile, + [Parameter(Mandatory=$true)] + [string]$marketplaceToken +) +Write-Output "Azure DevOps Migration Tools (Extension) Release" +Write-Output "----------------------------------------" +Write-Output "Extension file: $extensionFile" +Write-Output "----------------------------------------" +if (((npm list -g tfx-cli) -join "," ).Contains("empty")) { + Write-Output "Installing tfx-cli" + npm i -g tfx-cli +} else { Write-Output "Detected tfx-cli"} +Write-Output "----------------------------------------" +# Login +Write-Output ">>>>> Login" +tfx login --service-url https://marketplace.visualstudio.com --token $marketplaceToken +Write-Output "----------------------------------------" +Write-Output "----------------------------------------" +# Build TFS Extension +Write-Output ">>>>> Send TFS Extension" +tfx extension publish --vsix "$vsixFile" --token $marketplaceToken +Write-Output "----------------------------------------" \ No newline at end of file diff --git a/build/releaseWingetPackage.ps1 b/build/releaseWingetPackage.ps1 index d81b26d6e..543598824 100644 --- a/build/releaseWingetPackage.ps1 +++ b/build/releaseWingetPackage.ps1 @@ -8,7 +8,7 @@ param ( # name of the releaseTag [Parameter(Mandatory=$true)] - [string]$releaseTag, + [string]$ring, # GH_TOKEN [Parameter(Mandatory=$true)] @@ -33,13 +33,21 @@ Write-Host $"##[warning] $installURL" $wigetPackageId = "nkdAgility.AzureDevOpsMigrationTools" -if ($releaseTag -eq "Preview") -{ - $wigetPackageId = "$wigetPackageId.Preview" -} Write-Host "Winget Create with $wigetPackageId" - -./wingetcreate.exe update --submit --token $GH_TOKEN --urls $installURL --version $version $wigetPackageId +switch ($ring) { + "Preview" { + $wigetPackageId = "$wigetPackageId.Preview" + ./wingetcreate.exe update --submit --token $GH_TOKEN --urls $installURL --version $version $wigetPackageId + } + "Release" { + $wigetPackageId = "nkdAgility.AzureDevOpsMigrationTools" + ./wingetcreate.exe update --submit --token $GH_TOKEN --urls $installURL --version $version $wigetPackageId + } + default { + $wigetPackageId = "nkdAgility.AzureDevOpsMigrationTools.Canary" + Write-Host "We dont ship canary builds!" + } +} Write-Host "Deployed : $wigetPackageId"