| 
 | 1 | +#################################################################################  | 
 | 2 | +#                               OneBranch Pipelines                             #  | 
 | 3 | +# This pipeline was created by EasyStart from a sample located at:              #  | 
 | 4 | +#   https://aka.ms/obpipelines/easystart/samples                                #  | 
 | 5 | +# Documentation:  https://aka.ms/obpipelines                                    #  | 
 | 6 | +# Yaml Schema:    https://aka.ms/obpipelines/yaml/schema                        #  | 
 | 7 | +# Retail Tasks:   https://aka.ms/obpipelines/tasks                              #  | 
 | 8 | +# Support:        https://aka.ms/onebranchsup                                   #  | 
 | 9 | +#################################################################################  | 
 | 10 | + | 
 | 11 | +trigger: none  | 
 | 12 | + | 
 | 13 | +schedules:  | 
 | 14 | +- cron: '20 16 * * 4'  | 
 | 15 | +  displayName: Weekly CodeQL  | 
 | 16 | +  branches:  | 
 | 17 | +    include:  | 
 | 18 | +    - main  | 
 | 19 | +  always: true  | 
 | 20 | + | 
 | 21 | +parameters:  | 
 | 22 | +- name: debug  | 
 | 23 | +  displayName: Enable debug output  | 
 | 24 | +  type: boolean  | 
 | 25 | +  default: false  | 
 | 26 | + | 
 | 27 | +variables:  | 
 | 28 | +  system.debug: ${{ parameters.debug }}  | 
 | 29 | +  BuildConfiguration: Release  | 
 | 30 | +  WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest  | 
 | 31 | +  DOTNET_NOLOGO: true  | 
 | 32 | +  DOTNET_GENERATE_ASPNET_CERTIFICATE: false  | 
 | 33 | + | 
 | 34 | +resources:  | 
 | 35 | +  repositories:  | 
 | 36 | +    - repository: templates  | 
 | 37 | +      type: git  | 
 | 38 | +      name: OneBranch.Pipelines/GovernedTemplates  | 
 | 39 | +      ref: refs/heads/main  | 
 | 40 | + | 
 | 41 | +extends:  | 
 | 42 | +  # https://aka.ms/obpipelines/templates  | 
 | 43 | +  template: v2/OneBranch.Official.CrossPlat.yml@templates  | 
 | 44 | +  parameters:  | 
 | 45 | +    globalSdl: # https://aka.ms/obpipelines/sdl  | 
 | 46 | +      asyncSdl:  | 
 | 47 | +        enabled: true  | 
 | 48 | +        forStages: [build]  | 
 | 49 | +    featureFlags:  | 
 | 50 | +      EnableCDPxPAT: false  | 
 | 51 | +      WindowsHostVersion:  | 
 | 52 | +        Version: 2022  | 
 | 53 | +        Network: Netlock  | 
 | 54 | +    stages:  | 
 | 55 | +    - stage: build  | 
 | 56 | +      jobs:  | 
 | 57 | +      - job: main  | 
 | 58 | +        displayName: Build package  | 
 | 59 | +        pool:  | 
 | 60 | +          type: windows  | 
 | 61 | +        variables:  | 
 | 62 | +          ob_outputDirectory: $(Build.SourcesDirectory)/out  | 
 | 63 | +        steps:  | 
 | 64 | +          - pwsh: |  | 
 | 65 | +              [xml]$xml = Get-Content Engine/Engine.csproj  | 
 | 66 | +              $version = $xml.SelectSingleNode(".//VersionPrefix")."#text"  | 
 | 67 | +              Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"  | 
 | 68 | +            name: package  | 
 | 69 | +            displayName: Get version from project properties  | 
 | 70 | +          - task: onebranch.pipeline.version@1  | 
 | 71 | +            displayName: Set OneBranch version  | 
 | 72 | +            inputs:  | 
 | 73 | +              system: Custom  | 
 | 74 | +              customVersion: $(package.version)  | 
 | 75 | +          - task: UseDotNet@2  | 
 | 76 | +            displayName: Use .NET SDK  | 
 | 77 | +            inputs:  | 
 | 78 | +              packageType: sdk  | 
 | 79 | +              useGlobalJson: true  | 
 | 80 | +          - pwsh: |  | 
 | 81 | +              Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted  | 
 | 82 | +              Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet  | 
 | 83 | +              ./tools/installPSResources.ps1 -PSRepository CFS  | 
 | 84 | +            displayName: Install PSResources  | 
 | 85 | +          - pwsh: ./build.ps1 -Configuration Release -All  | 
 | 86 | +            displayName: Build  | 
 | 87 | +          - task: onebranch.pipeline.signing@1  | 
 | 88 | +            displayName: Sign 1st-party files  | 
 | 89 | +            inputs:  | 
 | 90 | +              command: sign  | 
 | 91 | +              signing_profile: external_distribution  | 
 | 92 | +              search_root: $(Build.SourcesDirectory)/out  | 
 | 93 | +              files_to_sign: |  | 
 | 94 | +                **/Microsoft.*.dll;  | 
 | 95 | +                **/*.psd1;  | 
 | 96 | +                **/*.ps1xml;  | 
 | 97 | +          - task: onebranch.pipeline.signing@1  | 
 | 98 | +            displayName: Sign 3rd-party files  | 
 | 99 | +            inputs:  | 
 | 100 | +              command: sign  | 
 | 101 | +              signing_profile: 135020002  | 
 | 102 | +              search_root: $(Build.SourcesDirectory)/out  | 
 | 103 | +              files_to_sign: |  | 
 | 104 | +                **/Newtonsoft.Json.dll;  | 
 | 105 | +                **/Pluralize.NET.dll;  | 
 | 106 | +          - pwsh: ./build.ps1 -BuildNupkg  | 
 | 107 | +            displayName: Package module  | 
 | 108 | +          - task: onebranch.pipeline.signing@1  | 
 | 109 | +            displayName: Sign NuGet package  | 
 | 110 | +            inputs:  | 
 | 111 | +              command: sign  | 
 | 112 | +              signing_profile: external_distribution  | 
 | 113 | +              search_root: $(Build.SourcesDirectory)/out  | 
 | 114 | +              files_to_sign: |  | 
 | 115 | +                *.nupkg  | 
 | 116 | +    - stage: release  | 
 | 117 | +      dependsOn: build  | 
 | 118 | +      condition: ne(variables['Build.Reason'], 'Schedule')  | 
 | 119 | +      variables:  | 
 | 120 | +        version: $[ stageDependencies.build.main.outputs['package.version'] ]  | 
 | 121 | +        drop: $(Pipeline.Workspace)/drop_build_main  | 
 | 122 | +      jobs:  | 
 | 123 | +      - job: github  | 
 | 124 | +        displayName: Publish draft to GitHub  | 
 | 125 | +        pool:  | 
 | 126 | +          type: windows  | 
 | 127 | +        variables:  | 
 | 128 | +          ob_outputDirectory: $(Build.SourcesDirectory)/out  | 
 | 129 | +        steps:  | 
 | 130 | +        - download: current  | 
 | 131 | +          displayName: Download artifacts  | 
 | 132 | +        - task: GitHubRelease@1  | 
 | 133 | +          displayName: Create GitHub release  | 
 | 134 | +          inputs:  | 
 | 135 | +            gitHubConnection: GitHub  | 
 | 136 | +            repositoryName: PowerShell/PSScriptAnalyzer  | 
 | 137 | +            assets: |  | 
 | 138 | +              $(drop)/PSScriptAnalyzer.$(version).nupkg  | 
 | 139 | +            tagSource: userSpecifiedTag  | 
 | 140 | +            tag: v$(version)  | 
 | 141 | +            isDraft: true  | 
 | 142 | +            addChangeLog: false  | 
 | 143 | +            releaseNotesSource: inline  | 
 | 144 | +            releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"  | 
 | 145 | +      - job: validation  | 
 | 146 | +        displayName: Manual validation  | 
 | 147 | +        pool:  | 
 | 148 | +          type: agentless  | 
 | 149 | +        timeoutInMinutes: 1440  | 
 | 150 | +        steps:  | 
 | 151 | +        - task: ManualValidation@0  | 
 | 152 | +          displayName: Wait 24 hours for validation  | 
 | 153 | +          inputs:  | 
 | 154 | +            notifyUsers: $(Build.RequestedForEmail)  | 
 | 155 | +            instructions: Please validate the release and then publish it!  | 
 | 156 | +            timeoutInMinutes: 1440  | 
 | 157 | +      - job: publish  | 
 | 158 | +        dependsOn: validation  | 
 | 159 | +        displayName: Publish to PowerShell Gallery  | 
 | 160 | +        pool:  | 
 | 161 | +          type: windows  | 
 | 162 | +        variables:  | 
 | 163 | +          ob_outputDirectory: $(Build.SourcesDirectory)/out  | 
 | 164 | +        steps:  | 
 | 165 | +        - download: current  | 
 | 166 | +          displayName: Download artifacts  | 
 | 167 | +        - task: NuGetCommand@2  | 
 | 168 | +          displayName: Publish module to PowerShell Gallery  | 
 | 169 | +          inputs:  | 
 | 170 | +            command: push  | 
 | 171 | +            packagesToPush: $(drop)/PSScriptAnalyzer.$(version).nupkg  | 
 | 172 | +            nuGetFeedType: external  | 
 | 173 | +            publishFeedCredentials: PowerShellGallery  | 
0 commit comments