|
| 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 | + ) |
0 commit comments