microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
.azdo/publish.yaml
207lines · modecode
| 1 | # ============================================================================= |
| 2 | # This pipeline publishes NuGet packages. Manually triggered only. |
| 3 | # Parameters: |
| 4 | # - packageSet: Legacy (Libraries/) or Core (core/) |
| 5 | # - publishType: Internal (unsigned, TeamsSDKPreviews feed) or Public (ESRP- |
| 6 | # signed, nuget.org, requires approval). |
| 7 | # Versions come from Nerdbank.GitVersioning, per packageSet: |
| 8 | # - Legacy: root version.json |
| 9 | # - Core: core/version.json (plus per-project overrides such as |
| 10 | # core/src/Microsoft.Teams.Apps/version.json) |
| 11 | # |
| 12 | # Extends 1ES.Official.PipelineTemplate for M365 security compliance. |
| 13 | # ============================================================================= |
| 14 | |
| 15 | resources: |
| 16 | repositories: |
| 17 | - repository: 1esPipelines |
| 18 | type: git |
| 19 | name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 20 | ref: refs/tags/release |
| 21 | |
| 22 | trigger: none |
| 23 | |
| 24 | pr: none |
| 25 | |
| 26 | parameters: |
| 27 | - name: packageSet |
| 28 | displayName: 'Package Set' |
| 29 | type: string |
| 30 | default: 'Core' |
| 31 | values: |
| 32 | - Legacy |
| 33 | - Core |
| 34 | - name: publishType |
| 35 | displayName: 'Publish Type' |
| 36 | type: string |
| 37 | default: 'Internal' |
| 38 | values: |
| 39 | - Internal |
| 40 | - Public |
| 41 | |
| 42 | variables: |
| 43 | buildConfiguration: 'Release' |
| 44 | folderPath: '$(Build.SourcesDirectory)' |
| 45 | ${{ if eq(parameters.publishType, 'Public') }}: |
| 46 | appRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' |
| 47 | authenticodeSignId: '2d5c4ab9-0b7e-4f60-bb92-70322df77b94' |
| 48 | nugetSignId: 'a94a770a-9a7b-4888-a3ea-24584b851e49' |
| 49 | |
| 50 | extends: |
| 51 | template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines |
| 52 | parameters: |
| 53 | pool: |
| 54 | name: Azure-Pipelines-1ESPT-ExDShared |
| 55 | image: ubuntu-22.04 |
| 56 | os: linux |
| 57 | |
| 58 | sdl: |
| 59 | sourceAnalysisPool: |
| 60 | name: Azure-Pipelines-1ESPT-ExDShared |
| 61 | image: windows-2022 |
| 62 | os: windows |
| 63 | |
| 64 | # Required for M365PT tracking and drift management |
| 65 | customBuildTags: |
| 66 | - ES365AIMigrationTooling |
| 67 | |
| 68 | stages: |
| 69 | |
| 70 | - ${{ if eq(parameters.publishType, 'Internal') }}: |
| 71 | - stage: Build_Test_Pack_Push_Internal |
| 72 | displayName: 'Build, Test, Pack, and Push (Internal)' |
| 73 | jobs: |
| 74 | - job: BuildTestPackPush |
| 75 | displayName: 'Build, Test, Pack, and Push to Internal Feed' |
| 76 | steps: |
| 77 | - checkout: self |
| 78 | - pwsh: | |
| 79 | $nugetConfig = @" |
| 80 | <?xml version="1.0" encoding="utf-8"?> |
| 81 | <configuration> |
| 82 | <packageSources> |
| 83 | <clear /> |
| 84 | <add key="TeamsSDKPreviews" value="https://pkgs.dev.azure.com/DomoreexpGithub/Github_Pipelines/_packaging/TeamsSDKPreviews/nuget/v3/index.json" /> |
| 85 | </packageSources> |
| 86 | </configuration> |
| 87 | "@ |
| 88 | $nugetConfig | Out-File -FilePath "$(Build.SourcesDirectory)/nuget.config" -Encoding utf8 |
| 89 | displayName: 'Create nuget.config' |
| 90 | |
| 91 | - task: NuGetAuthenticate@1 |
| 92 | displayName: 'Authenticate with NuGet feeds' |
| 93 | |
| 94 | - ${{ if eq(parameters.packageSet, 'Legacy') }}: |
| 95 | - template: .azdo/templates/build-test-pack.yaml@self |
| 96 | parameters: |
| 97 | sourceRoot: '.' |
| 98 | pack: true |
| 99 | packPattern: 'Libraries/**/*.csproj' |
| 100 | publishArtifact: false |
| 101 | - ${{ if eq(parameters.packageSet, 'Core') }}: |
| 102 | - template: .azdo/templates/build-test-pack.yaml@self |
| 103 | parameters: |
| 104 | sourceRoot: 'core' |
| 105 | pack: true |
| 106 | packPattern: 'core/src/**/*.csproj' |
| 107 | publishArtifact: false |
| 108 | |
| 109 | - task: 1ES.PublishNuget@1 |
| 110 | displayName: 'Push NuGet Packages to Internal Feed' |
| 111 | inputs: |
| 112 | useDotNetTask: false |
| 113 | packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' |
| 114 | packageParentPath: '$(Build.ArtifactStagingDirectory)' |
| 115 | publishVstsFeed: '$(System.TeamProject)/TeamsSDKPreviews' |
| 116 | nuGetFeedType: internal |
| 117 | allowPackageConflicts: false # Disallow duplicate versions; bump the version to re-publish |
| 118 | publishPackageMetadata: true |
| 119 | retryCountOnTaskFailure: 2 |
| 120 | |
| 121 | - task: 1ES.PublishPipelineArtifact@1 |
| 122 | displayName: 'Publish NuGet Packages as Pipeline Artifact' |
| 123 | inputs: |
| 124 | targetPath: '$(Build.ArtifactStagingDirectory)' |
| 125 | artifactName: 'Packages' |
| 126 | |
| 127 | - ${{ if eq(parameters.publishType, 'Public') }}: |
| 128 | - stage: Build_Test_Sign_Pack |
| 129 | displayName: 'Build, Test, Sign, and Pack (Public)' |
| 130 | jobs: |
| 131 | - job: BuildTestSignPack |
| 132 | displayName: 'Build, Test, Sign, and Pack' |
| 133 | steps: |
| 134 | - checkout: self |
| 135 | |
| 136 | - pwsh: | |
| 137 | $nugetConfig = @" |
| 138 | <?xml version="1.0" encoding="utf-8"?> |
| 139 | <configuration> |
| 140 | <packageSources> |
| 141 | <clear /> |
| 142 | <add key="TeamsSDKPreviews" value="https://pkgs.dev.azure.com/DomoreexpGithub/Github_Pipelines/_packaging/TeamsSDKPreviews/nuget/v3/index.json" /> |
| 143 | </packageSources> |
| 144 | </configuration> |
| 145 | "@ |
| 146 | $nugetConfig | Out-File -FilePath "$(Build.SourcesDirectory)/nuget.config" -Encoding utf8 |
| 147 | displayName: 'Create nuget.config' |
| 148 | |
| 149 | - task: NuGetAuthenticate@1 |
| 150 | displayName: 'Authenticate with NuGet feeds' |
| 151 | |
| 152 | - ${{ if eq(parameters.packageSet, 'Legacy') }}: |
| 153 | - template: .azdo/templates/build-test-pack.yaml@self |
| 154 | parameters: |
| 155 | sourceRoot: '.' |
| 156 | pack: false |
| 157 | publishArtifact: false |
| 158 | - ${{ if eq(parameters.packageSet, 'Core') }}: |
| 159 | - template: .azdo/templates/build-test-pack.yaml@self |
| 160 | parameters: |
| 161 | sourceRoot: 'core' |
| 162 | pack: false |
| 163 | publishArtifact: false |
| 164 | |
| 165 | - ${{ if eq(parameters.packageSet, 'Legacy') }}: |
| 166 | - template: .azdo/templates/sign-and-pack.yaml@self |
| 167 | parameters: |
| 168 | assemblyPattern: 'Libraries/**/*.dll' |
| 169 | packagePattern: 'Libraries/**/*.csproj' |
| 170 | - ${{ if eq(parameters.packageSet, 'Core') }}: |
| 171 | - template: .azdo/templates/sign-and-pack.yaml@self |
| 172 | parameters: |
| 173 | assemblyPattern: 'core/src/**/*.dll' |
| 174 | packagePattern: 'core/src/**/*.csproj' |
| 175 | |
| 176 | - task: 1ES.PublishPipelineArtifact@1 |
| 177 | displayName: 'Publish NuGet Packages as Pipeline Artifact' |
| 178 | inputs: |
| 179 | targetPath: '$(Build.ArtifactStagingDirectory)' |
| 180 | artifactName: 'Packages' |
| 181 | |
| 182 | - ${{ if eq(parameters.publishType, 'Public') }}: |
| 183 | - stage: PushToNuGet |
| 184 | displayName: 'Push Packages to nuget.org' |
| 185 | dependsOn: Build_Test_Sign_Pack |
| 186 | jobs: |
| 187 | - deployment: PushPackages |
| 188 | displayName: 'Manual Approval Required to Push Packages' |
| 189 | environment: |
| 190 | name: 'teams-net-publish' |
| 191 | strategy: |
| 192 | runOnce: |
| 193 | deploy: |
| 194 | steps: |
| 195 | - download: current |
| 196 | artifact: Packages |
| 197 | |
| 198 | - task: 1ES.PublishNuget@1 |
| 199 | displayName: 'Push Packages to nuget.org' |
| 200 | inputs: |
| 201 | useDotNetTask: false |
| 202 | packagesToPush: '$(Pipeline.Workspace)/Packages/*.nupkg' |
| 203 | packageParentPath: '$(Pipeline.Workspace)/Packages' |
| 204 | nuGetFeedType: external |
| 205 | publishFeedCredentials: 'Microsoft.Teams.*' |
| 206 | publishPackageMetadata: true |
| 207 | retryCountOnTaskFailure: 2 |
| 208 | |