Skip to content

Commit 0dc5885

Browse files
committed
Merge branch 'release_pipeline'
2 parents 36e73a7 + 1d9dc20 commit 0dc5885

6 files changed

Lines changed: 203 additions & 5 deletions

File tree

azure-pipelines.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,45 @@ steps:
3232
- task: PublishBuildArtifacts@1
3333
displayName: Save VSIX artifact
3434
inputs:
35-
PathtoPublish: src/CopyFunctionBreakpointName/bin/Release/CopyFunctionBreakpointName.vsix
35+
PathtoPublish: src\CopyFunctionBreakpointName\bin\Release\CopyFunctionBreakpointName.vsix
3636
ArtifactName: VSIX
3737

3838
- task: PublishBuildArtifacts@1
3939
displayName: Save symbols
4040
inputs:
41-
PathtoPublish: src/CopyFunctionBreakpointName/bin/Release/CopyFunctionBreakpointName.pdb
41+
PathtoPublish: src\CopyFunctionBreakpointName\bin\Release\CopyFunctionBreakpointName.pdb
4242
ArtifactName: Symbols
43+
44+
- task: CopyFiles@2
45+
displayName: Stage marketplace publish artifacts
46+
inputs:
47+
SourceFolder: '$(Build.SourcesDirectory)\resources'
48+
Contents: |
49+
VsixPublishManifest.json
50+
MarketplaceOverview.md
51+
context-menu.png
52+
created-breakpoint.png
53+
new-function-breakpoint-dialog.png
54+
new-function-breakpoint-menu.png
55+
TargetFolder: $(Build.ArtifactStagingDirectory)\Marketplace
56+
57+
- task: PublishBuildArtifacts@1
58+
displayName: Save marketplace publish artifacts
59+
inputs:
60+
PathtoPublish: $(Build.ArtifactStagingDirectory)\Marketplace
61+
ArtifactName: Marketplace
62+
63+
- task: CopyFiles@2
64+
displayName: Stage release pipeline source artifacts
65+
inputs:
66+
SourceFolder: '$(Build.SourcesDirectory)\build'
67+
Contents: |
68+
Release.ps1
69+
ReleasePipeline.ps1
70+
TargetFolder: $(Build.ArtifactStagingDirectory)\ReleasePipelineSource
71+
72+
- task: PublishBuildArtifacts@1
73+
displayName: Save release pipeline source artifacts
74+
inputs:
75+
PathtoPublish: $(Build.ArtifactStagingDirectory)\ReleasePipelineSource
76+
ArtifactName: ReleasePipelineSource

build/Release.ps1

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
function PublishToMarketplace(
2+
[Parameter(Mandatory=$true)] [string] $VsixPath,
3+
[Parameter(Mandatory=$true)] [string] $VsixPublishManifestPath,
4+
[Parameter(Mandatory=$true)] [string] $VsixMarketplaceAccessToken
5+
) {
6+
$visualStudioInstallation = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VSSDK -property installationPath
7+
8+
$vsixPublisher = Join-Path $visualStudioInstallation 'VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe'
9+
& $vsixPublisher publish -payload $VsixPath -publishManifest $VsixPublishManifestPath -personalAccessToken $VsixMarketplaceAccessToken
10+
}
11+
12+
function CreateGitHubRelease(
13+
[Parameter(Mandatory=$true)] [string] $GitHubAccessToken,
14+
[Parameter(Mandatory=$true)] [string] $Owner,
15+
[Parameter(Mandatory=$true)] [string] $Repository,
16+
[Parameter(Mandatory=$true)] [string] $Commit,
17+
[Parameter(Mandatory=$true)] [string] $Tag,
18+
[Parameter(Mandatory=$true)] [string] $Name,
19+
[string] $Body,
20+
[switch] $Draft,
21+
[switch] $Prerelease,
22+
[string[]] $Assets
23+
) {
24+
[System.Net.ServicePointManager]::SecurityProtocol = 'tls12'
25+
26+
$headers = @{
27+
Accept = 'application/vnd.github.v3+json'
28+
Authorization = "token $GitHubAccessToken"
29+
'User-Agent' = 'PowerShell'
30+
}
31+
32+
# https://developer.github.com/v3/repos/releases/#create-a-release
33+
$creationResult = Invoke-RestMethod `
34+
-Method 'post' `
35+
-Uri "https://api.github.com/repos/$Owner/$Repository/releases" `
36+
-Headers $headers `
37+
-Body (ConvertTo-Json @{
38+
tag_name = $Tag
39+
target_commitish = $Commit
40+
name = $Name
41+
body = $Body
42+
draft = $Draft.IsPresent
43+
prerelease = $Prerelease.IsPresent
44+
})
45+
46+
foreach ($asset in $Assets) {
47+
# https://developer.github.com/v3/repos/releases/#upload-a-release-asset
48+
$filename = Split-Path $asset -leaf
49+
$uploadUrl = $creationResult.upload_url -replace "\{\?[^}]+\}", "?name=$filename"
50+
51+
$null = Invoke-RestMethod `
52+
-Method 'post' `
53+
-Uri $uploadUrl `
54+
-Headers $headers `
55+
-ContentType 'application/zip' `
56+
-InFile $asset
57+
}
58+
}

build/ReleasePipeline.ps1

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<#
2+
Until release pipelines have YAML support (https://dev.azure.com/mseng/Azure%20DevOps%20Roadmap/_workitems/edit/1221170),
3+
as much as possible goes here.
4+
5+
Setup instructions:
6+
7+
1. Create secret release variables:
8+
9+
- VsixMarketplaceAccessToken, value obtained from Azure DevOps user settings (Security/Personal Access Tokens).
10+
Organization *must* be changed to ‘All accessible organizations’ at creation time. Editing later doesn’t work.
11+
Under Scopes, choose ‘Custom defined,’ ‘Show all scopes,’ and click Publish under the Marketplace group.
12+
13+
- GitHubReleaseAccessToken, value obtained from https://github.com/settings/tokens.
14+
Only scope needed is public_repo.
15+
16+
2. Add PowerShell task to the release pipeline job and set:
17+
18+
- Display name: Delegate to source-controlled file
19+
20+
- Script path: $(System.DefaultWorkingDirectory)\CI\ReleasePipelineSource\ReleasePipeline.ps1
21+
This assumes the build producing the artifacts is named CI and that one of the artifacts contains this file
22+
and is named ReleasePipelineSource. Refer to azure_pipelines.yml to see how the artifacts are created.
23+
24+
- Arguments: "$(VsixMarketplaceAccessToken)" "$(GitHubReleaseAccessToken)"
25+
26+
3. If you like, set Options > General > Release name format: Release $(Build.BuildNumber)
27+
Should be good to go!
28+
#>
29+
30+
# Secret release variables are injected
31+
Param(
32+
[Parameter(Mandatory=$true)] [string] $VsixMarketplaceAccessToken,
33+
[Parameter(Mandatory=$true)] [string] $GitHubReleaseAccessToken
34+
)
35+
36+
. "$PSScriptRoot\Release.ps1"
37+
38+
# Calculate release version by scripping the build metadata from the build version
39+
# (of the form ‘1.0.0+build.1234.commit.abcdef12’)
40+
$releaseVersion = $env:BUILD_BUILDNUMBER.Substring(0, $env:BUILD_BUILDNUMBER.IndexOfAny(('-', '+')))
41+
42+
PublishToMarketplace `
43+
"$env:SYSTEM_ARTIFACTSDIRECTORY\CI\VSIX\CopyFunctionBreakpointName.vsix" `
44+
"$env:SYSTEM_ARTIFACTSDIRECTORY\CI\Marketplace\VsixPublishManifest.json" `
45+
$VsixMarketplaceAccessToken
46+
47+
CreateGitHubRelease `
48+
-GitHubAccessToken $GitHubReleaseAccessToken `
49+
-Owner 'jnm2' `
50+
-Repository 'CopyFunctionBreakpointName' `
51+
-Commit $env:BUILD_SOURCEVERSION `
52+
-Tag "v$releaseVersion" `
53+
-Name $releaseVersion `
54+
-Body 'https://marketplace.visualstudio.com/items?itemName=jnm2.CopyFunctionBreakpointName' `
55+
-Assets (
56+
"$env:SYSTEM_ARTIFACTSDIRECTORY\CI\VSIX\CopyFunctionBreakpointName.vsix",
57+
"$env:SYSTEM_ARTIFACTSDIRECTORY\CI\Symbols\CopyFunctionBreakpointName.pdb"
58+
)

resources/MarketplaceOverview.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This extension enables you to quickly copy a name to the clipboard which the New Function Breakpoint dialog understands.
2+
This is useful when you cannot place a breakpoint directly in the current source view; for example, when viewing metadata or decompiled source, or when you’re in a separate instance of Visual Studio from the one in which you want to set the breakpoint.
3+
4+
Start by right-clicking the member inside which you want to break:
5+
6+
![Context menu screenshot](context-menu.png)
7+
8+
Then use <kbd>Ctrl</kbd>+<kbd>D</kbd>, <kbd>B</kbd> or your keyboard shortcut to open and focus the Breakpoints window:
9+
10+
![New function breakpoint menu](new-function-breakpoint-menu.png)
11+
12+
And then <kbd>Ctrl</kbd>+<kbd>B</kbd> or your keyboard shortcut to open the New Function Breakpoint dialog:
13+
14+
![New function breakpoint dialog](new-function-breakpoint-dialog.png)
15+
16+
Then <kbd>Ctrl</kbd>+<kbd>V</kbd> to paste and <kbd>Enter</kbd> to accept, and you’re done!
17+
18+
![Created breakpoint](created-breakpoint.png)
19+
20+
Currently requires Visual Studio 2017 Update 7 or later. The extension can be installed in Visual Studio 2019 but it has not been tested there.

resources/VsixPublishManifest.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json.schemastore.org/vsix-publish",
3+
"identity": {
4+
"internalName": "CopyFunctionBreakpointName"
5+
},
6+
"categories": [ "other", "coding" ],
7+
"overview": "MarketplaceOverview.md",
8+
"assetFiles": [
9+
{
10+
"pathOnDisk": "context-menu.png",
11+
"targetPath": "context-menu.png"
12+
},
13+
{
14+
"pathOnDisk": "created-breakpoint.png",
15+
"targetPath": "created-breakpoint.png"
16+
},
17+
{
18+
"pathOnDisk": "new-function-breakpoint-dialog.png",
19+
"targetPath": "new-function-breakpoint-dialog.png"
20+
},
21+
{
22+
"pathOnDisk": "new-function-breakpoint-menu.png",
23+
"targetPath": "new-function-breakpoint-menu.png"
24+
}
25+
],
26+
"publisher": "jnm2",
27+
"repo": "https://github.com/jnm2/CopyFunctionBreakpointName"
28+
}

src/CopyFunctionBreakpointName/source.extension.vsixmanifest

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="jnm2.VisualStudio.CopyFunctionBreakpointName.45b15182-43a5-43c7-8c3a-28a28338cbcb" Version="1.0.0" Language="en-US" Publisher="Joseph N. Musser II" />
4+
<Identity Id="jnm2.VisualStudio.CopyFunctionBreakpointName.51F0BA87-5508-434A-ADE8-ACBB04614F69" Version="1.0.0" Language="en-US" Publisher="Joseph Musser" />
55
<DisplayName>Copy Function Breakpoint Name</DisplayName>
6-
<Description xml:space="preserve">Enables you to right-click and copy a name which the New Function Breakpoint dialog understands. This is useful when you cannot place a breakpoint directly in the current source view; for example, when viewing metadata or decompiled source, or when you’re in a separate instance of Visual Studio from the one in which you want to set the breakpoint.</Description>
6+
<Description xml:space="preserve">Enables you to right-click and copy a name which the New Function Breakpoint dialog understands. This is useful when you cannot place a breakpoint directly in the current source view, e.g. metadata or decompiled source or a separate instance of Visual Studio.</Description>
77
<MoreInfo>https://github.com/jnm2/CopyFunctionBreakpointName#copyfunctionbreakpointname-extension</MoreInfo>
88
<License>LICENSE.txt</License>
9-
<Tags>breakpoint, function, name, clipboard, copy, metadata, decompiled, source</Tags>
9+
<Tags>breakpoint;function;name;clipboard;copy;metadata;decompiled;source</Tags>
1010
</Metadata>
1111
<Installation>
1212
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0.27703,17.0)" />

0 commit comments

Comments
 (0)