-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Microsoft/develop
Create initial release
- Loading branch information
Showing
9 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" /> | ||
<package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="1.7.13-rc" targetFramework="native" developmentDependency="true" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" /> | ||
<package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="1.7.13-rc" targetFramework="native" developmentDependency="true" /> | ||
<package id="Nerdbank.GitVersioning" version="1.5.97" targetFramework="native" developmentDependency="true" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MicroBuild.Core" version="0.2.0" targetFramework="native" developmentDependency="true" /> | ||
<package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="1.7.13-rc" targetFramework="native" developmentDependency="true" /> | ||
<package id="Nerdbank.GitVersioning" version="1.5.97" targetFramework="native" developmentDependency="true" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)" | ||
} |