Skip to content

Commit 1adbcb3

Browse files
authored
Samples VSIX Build And Release Pipeline (#124)
1 parent 94a9c87 commit 1adbcb3

File tree

3 files changed

+128
-1
lines changed

3 files changed

+128
-1
lines changed

Templates/VSIX/Directory.Build.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ xmlns:ns="http://schemas.microsoft.com/developer/vstemplate/2005">
166166
OutputPaths="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension).generated')"
167167
XslContent="$(_UnconditionalVsTemplateXslt)" />
168168
<!-- Replace the original .vstemplate -->
169+
<Delete Files="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension)')" />
169170
<Move SourceFiles="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension).generated')"
170-
DestinationFiles="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension)')" />
171+
DestinationFiles="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension)')" OverwriteReadOnlyFiles="true" />
171172

172173
<!-- Repack the archive -->
173174
<ZipDirectory SourceDirectory="$(_tempDir)"

Templates/VSIX/nuget.config

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<config>
4+
<clear />
5+
<add key="globalPackagesFolder" value="$\..\packages" />
6+
<add key="repositoryPath" value="$\..\packages" />
7+
</config>
8+
<packageSources>
9+
<clear />
10+
<add key="ProjectReunion internal" value="https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" />
11+
12+
</packageSources>
13+
<disabledPackageSources>
14+
<clear />
15+
</disabledPackageSources>
16+
</configuration>

WindowsAppSDK-BuildVSIX.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# see https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases for info on yaml ADO jobs
2+
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
3+
parameters:
4+
- name: "Action"
5+
displayName: "GitHub Release Action"
6+
type: string
7+
default: 'none'
8+
values:
9+
- 'none' # Only builds the VSIX and publish it to Build Artifacts.
10+
- 'create' # Builds and publishes the VSIX and also creates a github release
11+
- 'edit' # Builds and publishes the VSIX and edits an existing github release
12+
- 'delete' # Does not build the VSIX and deletes an existing github release
13+
# Version of the WindowsAppSDK used to build the Samples VSIX
14+
- name: "WinAppSDKVersion"
15+
displayName: "Windows App SDK version (Required except for 'delete' action)"
16+
type: string
17+
default: 'Placeholder'
18+
# This is used as a unique identifier for the GitHub Release.
19+
- name: "ReleaseTag"
20+
displayName: "Release Unique Identifier (Required for 'create','edit','delete' actions)"
21+
type: string
22+
default: 'Placeholder'
23+
# GitHubRelease@1 Action
24+
- name: "ReleaseTitle"
25+
displayName: "Release Title (Required for 'create','edit' actions)"
26+
type: string
27+
default: 'Placeholder'
28+
- name: "ReleaseNotes"
29+
displayName: "Release Notes (Required for 'create','edit' actions)"
30+
type: string
31+
default: 'Placeholder'
32+
- name: "IsDraft"
33+
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)"
34+
type: boolean
35+
default: False
36+
- name: "IsPreRelease"
37+
displayName: "IsPrelease: \n Indicate whether the release should be marked as a pre-release. (Effective only in 'create','edit' actions)"
38+
type: boolean
39+
default: False
40+
41+
stages:
42+
- stage: BuildAndReleaseVSIX
43+
jobs:
44+
- job: BuildAndReleaseVSIX
45+
pool:
46+
vmImage: 'windows-2022'
47+
steps:
48+
- task: NuGetAuthenticate@0
49+
inputs:
50+
nuGetServiceConnections: 'Internal-ReleaseSigned'
51+
52+
- ${{ if ne(parameters.Action, 'delete') }}:
53+
# Update path for MSIX reference in build\NuSpecs\build\Microsoft.WindowsAppSDK.AppXReference.props
54+
# Before, this was a hardcoded value
55+
- task: PowerShell@2
56+
displayName: 'Update version in Directory.Build.props'
57+
inputs:
58+
targetType: 'inline'
59+
script: |
60+
$file = '$(Build.SourcesDirectory)\Templates\VSIX\Directory.Build.props'
61+
$WinAppSDKVersion = '${{ parameters.WinAppSDKVersion }}'
62+
[xml]$props = Get-Content -Encoding utf8 -Path $file
63+
$props.Project.PropertyGroup.WindowsAppSdkVersion.innerText = $WinAppSDKVersion
64+
Write-Host $props.OuterXml
65+
Set-Content -Encoding utf8 -Value $props.OuterXml $file
66+
67+
- task: VSBuild@1
68+
displayName: 'Restore WindowsAppSDKSampleVSIX.sln'
69+
inputs:
70+
solution: $(Build.SourcesDirectory)\Templates\VSIX\WindowsAppSDKSampleVSIX.sln
71+
platform: 'Any CPU'
72+
configuration: 'Release'
73+
msBuildArgs: '/t:restore'
74+
75+
- task: VSBuild@1
76+
displayName: 'Build WindowsAppSDKSampleVSIX.sln'
77+
inputs:
78+
solution: $(Build.SourcesDirectory)\Templates\VSIX\WindowsAppSDKSampleVSIX.sln
79+
platform: 'Any CPU'
80+
configuration: 'Release'
81+
82+
- task: CopyFiles@2
83+
displayName: 'Extract files for Nuget Package from Full: DWriteCorePackageName'
84+
inputs:
85+
SourceFolder: '$(Build.SourcesDirectory)\Templates\VSIX\bin\Release'
86+
Contents: |
87+
WindowsAppSDKSampleVSIX.vsix
88+
TargetFolder: '$(Build.ArtifactStagingDirectory)\VSIX'
89+
flattenFolders: false
90+
91+
- task: PublishBuildArtifacts@1
92+
displayName: 'Publish VSIX artifacts'
93+
inputs:
94+
PathtoPublish: '$(Build.ArtifactStagingDirectory)\VSIX'
95+
ArtifactName: 'VSIX'
96+
97+
- ${{ if ne(parameters.Action, 'none') }}:
98+
- task: GitHubRelease@1
99+
inputs:
100+
gitHubConnection: 'GitHub - benkuhn - 2-18'
101+
repositoryName: 'microsoft/WindowsAppSDK-Samples'
102+
action: ${{ parameters.Action }}
103+
tag: ${{ parameters.ReleaseTag }}
104+
title: ${{ parameters.ReleaseTitle }}
105+
assets: '$(Build.ArtifactStagingDirectory)/VSIX/WindowsAppSDKSampleVSIX.vsix'
106+
tagSource: 'userSpecifiedTag'
107+
isDraft: ${{ parameters.IsDraft }}
108+
releaseNotesSource: 'inline'
109+
releaseNotesInline: ${{ parameters.ReleaseNotes }}
110+
addChangeLog: false

0 commit comments

Comments
 (0)