From a3074d698ea4af65349971756ad9e47bb82d1f27 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Thu, 23 Feb 2017 00:33:53 -0800 Subject: [PATCH 1/2] Add appveyor definition --- appveyor.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..2d61424 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,34 @@ +configuration: + - Debug + - Release + +environment: + TreatWarningsAsErrors: true + +branches: + only: + - master + - develop + +skip_tags: true + +notifications: + - provider: GitHubPullRequest + on_build_success: true + on_build_failure: true + +cache: + - packages -> **\packages.config + +before_build: + - nuget restore + +test: + assemblies: + - bin\$(configuration)\*.test.dll + +artifacts: + - path: bin\$(configuration) + type: zip + +# vim: set ai et st=2 sts=2 sw=2: From eb16d79abe5cb32315cf224c8982b959eb901dfa Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Thu, 23 Feb 2017 10:15:16 -0800 Subject: [PATCH 2/2] Add MicroBuild support for signed releases Adds the necessary configuration to produce real-signed builds from our VSTS connection and publish them back to GitHub. --- README.md | 9 +++ src/vswhere.lib/packages.config | 1 + src/vswhere.lib/vswhere.lib.vcxproj | 4 + src/vswhere/packages.config | 1 + src/vswhere/vswhere.vcxproj | 10 +++ test/vswhere.test/packages.config | 1 + test/vswhere.test/vswhere.test.vcxproj | 4 + tools/Publish-Release.ps1 | 100 +++++++++++++++++++++++++ 8 files changed, 130 insertions(+) create mode 100644 tools/Publish-Release.ps1 diff --git a/README.md b/README.md index 2180e0c..6c4a638 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,12 @@ To file issues or suggestions, please use the [Issues](https://github.com/Micros ## License This project is licensed under the [MIT license](LICENSE.txt). + +## Status + +This project uses a Git flow model releasing from the `master` branch with development based on and stabilized in the `develop` branch. + +Branch | AppVeyor | VSTS +------ | ------ | ------- +master | [![build status: master](https://ci.appveyor.com/api/projects/status/yy3g7rggm2sx4nam/branch/master?svg=true)](https://ci.appveyor.com/project/heaths/vswhere/branch/master) | ![build status: master](https://devdiv.visualstudio.com/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/5581/badge) +develop | [![build status: develop](https://ci.appveyor.com/api/projects/status/yy3g7rggm2sx4nam/branch/develop?svg=true)](https://ci.appveyor.com/project/heaths/vswhere/branch/develop) diff --git a/src/vswhere.lib/packages.config b/src/vswhere.lib/packages.config index 8b03867..28cef17 100644 --- a/src/vswhere.lib/packages.config +++ b/src/vswhere.lib/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/vswhere.lib/vswhere.lib.vcxproj b/src/vswhere.lib/vswhere.lib.vcxproj index cbda529..4aefc2d 100644 --- a/src/vswhere.lib/vswhere.lib.vcxproj +++ b/src/vswhere.lib/vswhere.lib.vcxproj @@ -1,5 +1,6 @@  + Debug @@ -196,11 +197,14 @@ + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + \ No newline at end of file diff --git a/src/vswhere/packages.config b/src/vswhere/packages.config index b9c845d..022f5e8 100644 --- a/src/vswhere/packages.config +++ b/src/vswhere/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file diff --git a/src/vswhere/vswhere.vcxproj b/src/vswhere/vswhere.vcxproj index 48ce7ad..f59883a 100644 --- a/src/vswhere/vswhere.vcxproj +++ b/src/vswhere/vswhere.vcxproj @@ -1,5 +1,6 @@  + Debug @@ -106,11 +107,18 @@ + + + Microsoft + false + + + @@ -118,5 +126,7 @@ + + \ No newline at end of file diff --git a/test/vswhere.test/packages.config b/test/vswhere.test/packages.config index b9c845d..022f5e8 100644 --- a/test/vswhere.test/packages.config +++ b/test/vswhere.test/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file diff --git a/test/vswhere.test/vswhere.test.vcxproj b/test/vswhere.test/vswhere.test.vcxproj index 15974db..b1c7ed2 100644 --- a/test/vswhere.test/vswhere.test.vcxproj +++ b/test/vswhere.test/vswhere.test.vcxproj @@ -1,5 +1,6 @@  + Debug @@ -128,6 +129,7 @@ + @@ -135,5 +137,7 @@ + + \ No newline at end of file diff --git a/tools/Publish-Release.ps1 b/tools/Publish-Release.ps1 new file mode 100644 index 0000000..945103c --- /dev/null +++ b/tools/Publish-Release.ps1 @@ -0,0 +1,100 @@ +# Copyright (C) Microsoft Corporation. All rights reserved. +# Licensed under the MIT license. See LICENSE.txt in the project root for license information. + +[CmdletBinding()] +param ( + [Parameter(Mandatory = $true)] + [string] $Token, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [string] $Owner = 'Microsoft', + + [Parameter(Mandatory = $true)] + [string] $Repository, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [string] $Tag = $env:BUILD_BUILDNUMBER, + + [Parameter()] + [string] $Commit = $env:BUILD_SOURCEVERSION, + + [Parameter()] + [string] $Name, + + [Parameter()] + [string] $Description, + + [Parameter()] + [switch] $Draft, + + [Parameter()] + [switch] $Prerelease, + + [Parameter(Mandatory = $true)] + [string] $Path, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [string] $ContentType = 'application/octet-stream', + + [Parameter()] + [string] $ContentName, + + [Parameter()] + [string] $ContentLabel +) + +$ErrorActionPreference = 'Stop' + +if (-not $Tag) { + throw '$Tag is required (default value not available)' +} + +$uri = "https://api.github.com/repos/$Owner/$Repository/releases" +$values = @{ + tag_name = $Tag + draft = $Draft.ToBool() + prerelease = $Prerelease.ToBool() +} + +if ($Commit) { + $values.target_commitish = $Commit +} + +if ($Name) { + $values.name = $Name +} + +if ($Description) { + $values.body = $Description +} + +$request = ConvertTo-Json $values +$headers = @{ + Authorization = "token $Token" + Accept = 'application/vnd.github.v3+json' +} + +$release = Invoke-RestMethod -Uri $uri -Method Post -Body $request -Headers $headers +$upload_url = $release.upload_url -replace '\{\?.*$', '' + +Write-Verbose "Release '$($release.id)' created; upload URI: $upload_url" + +$Path = Resolve-Path $Path | Convert-Path + +$headers.Add('Content-Type', $ContentType) +if (-not $ContentName) { + $ContentName = [System.IO.Path]::GetFileName($Path) +} + +$uri = $upload_url + "?name=$ContentName" +if ($ContentLabel) { + $uri += "&label=$ContentLabel" +} + +$asset = Invoke-RestMethod -Uri $uri -Method Post -InFile $Path -Headers $headers +if ($asset.state -eq 'uploaded') { + Write-Verbose "Successfully uploaded: $($asset.browser_download_url)" +}