-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathazure-pipeline-merge.yml
75 lines (75 loc) · 4.71 KB
/
azure-pipeline-merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected.
# This pipeline will be extended to the OneESPT template
# If you are not using the E+D shared hosted pool with windows-2022, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage
trigger:
- main
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: MSSecurity-1ES-Build-Agents-Pool
image: MSSecurity-1ES-Windows-2022
os: windows
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: stage
jobs:
- job: job
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
version: '9.x'
performMultiLevelLookup: true
- script: dotnet workload restore src/EventLogExpert.sln
displayName: 'dotnet workload restore'
- script: dotnet test src/EventLogExpert.sln
displayName: 'dotnet test'
- pwsh: |
$now = [DateTime]::UtcNow
$versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)"
Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString"
Write-Host $versionString
displayName: 'create version string'
- pwsh: |
echo "ReleaseVersion: $(ReleaseVersion)"
[xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest"
$manifest.Package.Identity.Version = "$(ReleaseVersion)"
$manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest")
Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest"
displayName: 'set version in manifest'
- pwsh: >
dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` --self-contained ` -c Release ` -o "$(build.artifactStagingDirectory)" ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:PublishSingleFile=true ` -p:Version=$(ReleaseVersion)
displayName: 'dotnet publish EventDbTool'
- pwsh: >
dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net9.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion)
displayName: 'dotnet publish EventLogExpert'
- pwsh: |
Get-ChildItem -Recurse "$(build.artifactStagingDirectory)"
displayName: 'show all files'
- pwsh: |
Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
$msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory
echo "msixFolder: $msixFolder"
Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" }
displayName: 'move msix to staging directory'
- pwsh: |
Get-ChildItem "$(build.artifactStagingDirectory)"
displayName: 'show staging directory'
- pwsh: |
$appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller"
[xml]$appinstaller = Get-Content -Raw $appInstallerFile
$appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/"
$appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/"
$appInstaller.Save($appInstallerFile)
Get-Content $appInstallerFile
displayName: 'update appinstaller paths'