devops-for-windows-apps/azure-pipelines.yml

115 строки
3.6 KiB
YAML

trigger:
branches:
include:
- master
- rel/*
paths:
exclude:
- '**/*.md'
- 'UITests/*'
pr:
branches:
include:
- master
- rel/*
paths:
exclude:
- '**/*.md'
- 'UITests/*'
variables:
BuildConfiguration: Release
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
- job: Build
pool:
vmImage: windows-2019
strategy:
matrix:
Channel_CD_Web:
ChannelName: CD-Web
DistributionUrl: https://mywpfapp.azurewebsites.net/CD
MsixPackageId: MyWPFApp.DevOpsDemo.CD
MsixPublisherId: CN=build
MsixPackageDisplayName: MyWPFApp (CD)
MsixBuildMode: SideLoadOnly
MsixGenerateAppInstaller: true
Channel_Prod_Web:
ChannelName: Prod-Web
DistributionUrl: https://mywpfapp.z5.web.core.windows.net/Prod
MsixPackageId: MyWPFApp.DevOpsDemo
MsixPublisherId: CN=build
MsixPackageDisplayName: MyWPFApp (Prod)
MsixBuildMode: SideLoadOnly
MsixGenerateAppInstaller: true
Channel_Prod_Store:
ChannelName: Prod-Store
DistributionUrl: https://not/used
MsixPackageId: MyWPFApp
MsixPublisherId: CN=E40A5878-9BC7-45A3-BBFC-B988EA6795B5
MsixPackageDisplayName: MyWPFApp (Store)
MsixBuildMode: CI
MsixGenerateAppInstaller: false
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK 3.0.x'
inputs:
version: 3.0.x
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: nbgv cloud -c -a
displayName: Set Version
- powershell: |
# Update appxmanifest. This must be done before build.
# Set the per-channel values into the appxmanifest, replacing the checked-in values
[xml]$manifest= get-content ".\MyWPFApp.Package\Package.appxmanifest"
$manifest.Package.Identity.Version = "$(GitBuildVersionSimple).0"
$manifest.Package.Identity.Name = "$(MsixPackageId)"
$manifest.Package.Identity.Publisher = "$(MsixPublisherId)"
$manifest.Package.Properties.DisplayName = "$(MsixPackageDisplayName)"
$manifest.Package.Applications.Application.VisualElements.DisplayName = "$(MsixPackageDisplayName)"
$manifest.save(".\MyWPFApp.Package\Package.appxmanifest")
displayName: Update manifest version
- powershell: |
# Update App Insights instrumentation key
[xml]$doc = Get-Content ".\MyWPFApp\ApplicationInsights.config"
$doc.ApplicationInsights.InstrumentationKey = "$(AppInsightsKey)"
$doc.save(".\MyWPFApp\ApplicationInsights.config")
displayName: Set AppInsights Config
env:
AppInsightsKey: $(AppInsightsKey)
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['AppInsightsKey'], '')))
- task: MSBuild@1
displayName: Build for $(BuildConfiguration)
inputs:
solution: MyWPFApp.sln
platform: x86
msbuildArguments: /restore /p:AppInstallerUri=$(DistributionUrl) /p:UapAppxPackageBuildMode=$(MsixBuildMode) /p:GenerateAppInstallerFile=$(MsixGenerateAppInstaller)
configuration: $(BuildConfiguration)
maximumCpuCount: false
- script: copy build.cer MyWPFApp.Package\AppPackages\MyWPFApp.Package_$(GitBuildVersionSimple).0_x86_Test\MyWPFApp.Package_$(GitBuildVersionSimple).0_x86.cer
displayName: Copy Certificate to versioned dir
condition: and(succeeded(), not(eq(variables['ChannelName'], 'Prod-Store')))
- task: PublishPipelineArtifact@0
inputs:
artifactName: $(ChannelName)
targetPath: MyWPFApp.Package/AppPackages