-
Notifications
You must be signed in to change notification settings - Fork 233
/
WindowsAppSDK-BuildVSIX.yml
110 lines (103 loc) · 4.46 KB
/
WindowsAppSDK-BuildVSIX.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# see https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases for info on yaml ADO jobs
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
parameters:
- name: "Action"
displayName: "GitHub Release Action"
type: string
default: 'none'
values:
- 'none' # Only builds the VSIX and publish it to Build Artifacts.
- 'create' # Builds and publishes the VSIX and also creates a github release
- 'edit' # Builds and publishes the VSIX and edits an existing github release
- 'delete' # Does not build the VSIX and deletes an existing github release
# Version of the WindowsAppSDK used to build the Samples VSIX
- name: "WinAppSDKVersion"
displayName: "Windows App SDK version (Required except for 'delete' action)"
type: string
default: 'Placeholder'
# This is used as a unique identifier for the GitHub Release.
- name: "ReleaseTag"
displayName: "Release Unique Identifier (Required for 'create','edit','delete' actions)"
type: string
default: 'Placeholder'
# GitHubRelease@1 Action
- name: "ReleaseTitle"
displayName: "Release Title (Required for 'create','edit' actions)"
type: string
default: 'Placeholder'
- name: "ReleaseNotes"
displayName: "Release Notes (Required for 'create','edit' actions)"
type: string
default: 'Placeholder'
- name: "IsDraft"
displayName: "IsDraft: \n Indicate whether the release should be saved as a draft (unpublished). If unchecked, the release will be published. (Effective only in 'create','edit' actions)"
type: boolean
default: False
- name: "IsPreRelease"
displayName: "IsPrelease: \n Indicate whether the release should be marked as a pre-release. (Effective only in 'create','edit' actions)"
type: boolean
default: False
stages:
- stage: BuildAndReleaseVSIX
jobs:
- job: BuildAndReleaseVSIX
pool:
vmImage: 'windows-2022'
steps:
- task: NuGetAuthenticate@0
inputs:
nuGetServiceConnections: 'Internal-ReleaseSigned'
- ${{ if ne(parameters.Action, 'delete') }}:
# Update path for MSIX reference in build\NuSpecs\build\Microsoft.WindowsAppSDK.AppXReference.props
# Before, this was a hardcoded value
- task: PowerShell@2
displayName: 'Update version in Directory.Build.props'
inputs:
targetType: 'inline'
script: |
$file = '$(Build.SourcesDirectory)\Templates\VSIX\Directory.Build.props'
$WinAppSDKVersion = '${{ parameters.WinAppSDKVersion }}'
[xml]$props = Get-Content -Encoding utf8 -Path $file
$props.Project.PropertyGroup.WindowsAppSdkVersion.innerText = $WinAppSDKVersion
Write-Host $props.OuterXml
Set-Content -Encoding utf8 -Value $props.OuterXml $file
- task: VSBuild@1
displayName: 'Restore WindowsAppSDKSampleVSIX.sln'
inputs:
solution: $(Build.SourcesDirectory)\Templates\VSIX\WindowsAppSDKSampleVSIX.sln
platform: 'Any CPU'
configuration: 'Release'
msBuildArgs: '/t:restore'
- task: VSBuild@1
displayName: 'Build WindowsAppSDKSampleVSIX.sln'
inputs:
solution: $(Build.SourcesDirectory)\Templates\VSIX\WindowsAppSDKSampleVSIX.sln
platform: 'Any CPU'
configuration: 'Release'
- task: CopyFiles@2
displayName: 'Extract files for Nuget Package from Full: DWriteCorePackageName'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\Templates\VSIX\bin\Release'
Contents: |
WindowsAppSDKSampleVSIX.vsix
TargetFolder: '$(Build.ArtifactStagingDirectory)\VSIX'
flattenFolders: false
- task: PublishBuildArtifacts@1
displayName: 'Publish VSIX artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\VSIX'
ArtifactName: 'VSIX'
- ${{ if ne(parameters.Action, 'none') }}:
- task: GitHubRelease@1
inputs:
gitHubConnection: 'GitHub - benkuhn - 2-18'
repositoryName: 'microsoft/WindowsAppSDK-Samples'
action: ${{ parameters.Action }}
tag: ${{ parameters.ReleaseTag }}
title: ${{ parameters.ReleaseTitle }}
assets: '$(Build.ArtifactStagingDirectory)/VSIX/WindowsAppSDKSampleVSIX.vsix'
tagSource: 'userSpecifiedTag'
isDraft: ${{ parameters.IsDraft }}
releaseNotesSource: 'inline'
releaseNotesInline: ${{ parameters.ReleaseNotes }}
addChangeLog: false