Skip to content

Commit

Permalink
Samples VSIX Build And Release Pipeline (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
kythant authored Nov 11, 2021
1 parent 94a9c87 commit 1adbcb3
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Templates/VSIX/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ xmlns:ns="http://schemas.microsoft.com/developer/vstemplate/2005">
OutputPaths="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension).generated')"
XslContent="$(_UnconditionalVsTemplateXslt)" />
<!-- Replace the original .vstemplate -->
<Delete Files="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension)')" />
<Move SourceFiles="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension).generated')"
DestinationFiles="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension)')" />
DestinationFiles="@(_allVsTemplates->'$(_tempDir)%(RecursiveDir)%(Filename)%(Extension)')" OverwriteReadOnlyFiles="true" />

<!-- Repack the archive -->
<ZipDirectory SourceDirectory="$(_tempDir)"
Expand Down
16 changes: 16 additions & 0 deletions Templates/VSIX/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<clear />
<add key="globalPackagesFolder" value="$\..\packages" />
<add key="repositoryPath" value="$\..\packages" />
</config>
<packageSources>
<clear />
<add key="ProjectReunion internal" value="https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" />

</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
110 changes: 110 additions & 0 deletions WindowsAppSDK-BuildVSIX.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 1adbcb3

Please sign in to comment.