-
Notifications
You must be signed in to change notification settings - Fork 31
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 #614 from TestCentric/issue-612
Create Draft Release on GitHub for Release branch builds
- Loading branch information
Showing
8 changed files
with
219 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## Configuration values used when creating new releases | ||
#create: | ||
# include-footer: true | ||
# footer-heading: Where to get it | ||
# footer-content: >- | ||
# You can download this release from | ||
# | ||
# [chocolatey](https://chocolatey.org/packages/chocolateyGUI/{milestone}) | ||
# footer-includes-milestone: false | ||
# milestone-replace-text: '{milestone}' | ||
# include-sha-section: false | ||
# sha-section-heading: SHA256 Hashes of the release artifacts | ||
# sha-section-line-format: '- `{1} {0}`' | ||
# allow-update-to-published: false | ||
## Configuration values used when exporting release notes | ||
#export: | ||
# include-created-date-in-title: false | ||
# created-date-string-format: MMMM dd, yyyy | ||
# perform-regex-removal: false | ||
# regex-text: '### Where to get it(\r\n)*You can .*\.' | ||
# multiline-regex: false | ||
## Configuration values used when closing a milestone | ||
#close: | ||
## Whether to add comments to issues closed and with the published milestone release. | ||
# use-issue-comments: false | ||
# issue-comment: |- | ||
# :tada: This issue has been resolved in version {milestone} :tada: | ||
# | ||
# The release is available on: | ||
# | ||
# - [NuGet package(@{milestone})](https://nuget.org/packages/{repository}/{milestone}) | ||
# - [GitHub release](https://github.com/{owner}/{repository}/releases/tag/{milestone}) | ||
# | ||
# Your **[GitReleaseManager](https://github.com/GitTools/GitReleaseManager)** bot :package::rocket: | ||
## The labels that will be used to include issues in release notes. | ||
issue-labels-include: | ||
- Feature | ||
- Enhancement | ||
- Bug | ||
- Build | ||
#- Duplicate | ||
#- Help Wanted | ||
#- Improvement | ||
#- Invalid | ||
#- Question | ||
#- WontFix | ||
## The labels that will NOT be used when including issues in release notes. | ||
#issue-labels-exclude: | ||
#- Internal Refactoring | ||
## Overrides default pluralization and header names for specific labels. | ||
issue-labels-alias: | ||
- name: Build | ||
header: Build | ||
plural: Build | ||
#- name: Documentation | ||
# header: Documentation | ||
# plural: Documentation | ||
## The labels that will NOT be used when including issues in release notes. | ||
#issue-labels-exclude: | ||
#- Internal Refactoring | ||
# |
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
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 |
---|---|---|
|
@@ -18,9 +18,9 @@ public class BuildParameters | |
|
||
// Environment Variable names holding GitHub identity of user | ||
// These are only used to publish the website when running locally | ||
// private const string GITHUB_USER_ID = "GITHUB_USER_ID"; | ||
// private const string GITHUB_USER_EMAIL = "GITHUB_USER_EMAIL"; | ||
private const string GITHUB_PASSWORD = "GITHUB_PASSWORD"; | ||
// Access token is used by GitReleaseManager | ||
private const string GITHUB_ACCESS_TOKEN = "GITHUB_ACCESS_TOKEN"; | ||
|
||
// Pre-release labels that we publish | ||
private static readonly string[] LABELS_WE_PUBLISH_ON_MYGET = { "dev", "pre" }; | ||
|
@@ -49,13 +49,23 @@ public class BuildParameters | |
Configuration = context.Argument("configuration", DEFAULT_CONFIGURATION); | ||
ProjectDirectory = context.Environment.WorkingDirectory.FullPath + "/"; | ||
|
||
Versions = new BuildVersion(context, this); | ||
MyGetApiKey = _context.EnvironmentVariable(MYGET_API_KEY); | ||
NuGetApiKey = _context.EnvironmentVariable(NUGET_API_KEY); | ||
ChocolateyApiKey = _context.EnvironmentVariable(CHOCO_API_KEY); | ||
|
||
UsingXBuild = context.EnvironmentVariable("USE_XBUILD") != null; | ||
|
||
GitHubPassword = _context.EnvironmentVariable(GITHUB_PASSWORD); | ||
GitHubAccessToken = _context.EnvironmentVariable(GITHUB_ACCESS_TOKEN); | ||
|
||
BuildVersion = new BuildVersion(context, this); | ||
//ReleaseManager = new ReleaseManager(context, this); | ||
|
||
if (context.HasArgument("testLevel")) | ||
PackageTestLevel = context.Argument("testLevel", 1); | ||
else if (!Versions.IsPreRelease) | ||
else if (!BuildVersion.IsPreRelease) | ||
PackageTestLevel = 3; | ||
else switch (Versions.PreReleaseLabel) | ||
else switch (BuildVersion.PreReleaseLabel) | ||
{ | ||
case "pre": | ||
case "rc": | ||
|
@@ -73,16 +83,6 @@ public class BuildParameters | |
break; | ||
} | ||
|
||
MyGetApiKey = _context.EnvironmentVariable(MYGET_API_KEY); | ||
NuGetApiKey = _context.EnvironmentVariable(NUGET_API_KEY); | ||
ChocolateyApiKey = _context.EnvironmentVariable(CHOCO_API_KEY); | ||
|
||
// GitHubUserId = _context.EnvironmentVariable(GITHUB_USER_ID); | ||
// GitHubUserEmail = _context.EnvironmentVariable(GITHUB_USER_EMAIL); | ||
GitHubPassword = _context.EnvironmentVariable(GITHUB_PASSWORD); | ||
|
||
UsingXBuild = context.EnvironmentVariable("USE_XBUILD") != null; | ||
|
||
MSBuildSettings = new MSBuildSettings { | ||
Verbosity = Verbosity.Minimal, | ||
ToolVersion = MSBuildToolVersion.Default,//The highest available MSBuild tool version//VS2017 | ||
|
@@ -119,11 +119,13 @@ public class BuildParameters | |
|
||
public string Configuration { get; } | ||
|
||
public BuildVersion Versions { get; } | ||
public string PackageVersion => Versions.PackageVersion; | ||
public string AssemblyVersion => Versions.AssemblyVersion; | ||
public string AssemblyFileVersion => Versions.AssemblyFileVersion; | ||
public string AssemblyInformationalVersion => Versions.AssemblyInformationalVersion; | ||
public BuildVersion BuildVersion { get; } | ||
public string PackageVersion => BuildVersion.PackageVersion; | ||
public string AssemblyVersion => BuildVersion.AssemblyVersion; | ||
public string AssemblyFileVersion => BuildVersion.AssemblyFileVersion; | ||
public string AssemblyInformationalVersion => BuildVersion.AssemblyInformationalVersion; | ||
|
||
//public ReleaseManager ReleaseManager { get; } | ||
|
||
public int PackageTestLevel { get; } | ||
|
||
|
@@ -170,11 +172,16 @@ public class BuildParameters | |
public bool IsNuGetApiKeyAvailable => !string.IsNullOrEmpty(NuGetApiKey); | ||
public bool IsChocolateyApiKeyAvailable => !string.IsNullOrEmpty(ChocolateyApiKey); | ||
|
||
public bool IsPreRelease => Versions.IsPreRelease; | ||
public bool IsFinalRelease => !IsPreRelease; | ||
public bool ShouldPublishToMyGet => IsFinalRelease || LABELS_WE_PUBLISH_ON_MYGET.Contains(Versions.PreReleaseLabel); | ||
public bool ShouldPublishToNuGet => IsFinalRelease || LABELS_WE_PUBLISH_ON_NUGET.Contains(Versions.PreReleaseLabel); | ||
public bool ShouldPublishToChocolatey => IsFinalRelease || LABELS_WE_PUBLISH_ON_CHOCOLATEY.Contains(Versions.PreReleaseLabel); | ||
public string BranchName => BuildVersion.BranchName; | ||
public bool IsReleaseBranch => BuildVersion.IsReleaseBranch; | ||
|
||
public bool IsPreRelease => BuildVersion.IsPreRelease; | ||
public bool ShouldPublishToMyGet => !IsPreRelease && !IsReleaseBranch || | ||
LABELS_WE_PUBLISH_ON_MYGET.Contains(BuildVersion.PreReleaseLabel); | ||
public bool ShouldPublishToNuGet => !IsPreRelease && !IsReleaseBranch || | ||
LABELS_WE_PUBLISH_ON_NUGET.Contains(BuildVersion.PreReleaseLabel); | ||
public bool ShouldPublishToChocolatey => !IsPreRelease && !IsReleaseBranch || | ||
LABELS_WE_PUBLISH_ON_CHOCOLATEY.Contains(BuildVersion.PreReleaseLabel); | ||
public bool IsProductionRelease => ShouldPublishToNuGet || ShouldPublishToChocolatey; | ||
|
||
public bool UsingXBuild { get; } | ||
|
@@ -193,6 +200,7 @@ public class BuildParameters | |
public string GitHubUserId => "charliepoole"; | ||
public string GitHubUserEmail => "[email protected]"; | ||
public string GitHubPassword { get; } | ||
public string GitHubAccessToken { get; } | ||
|
||
private void Validate() | ||
{ | ||
|
@@ -208,6 +216,12 @@ public class BuildParameters | |
errors.Add("Chocolatey ApiKey was not set."); | ||
} | ||
|
||
if (TasksToExecute.Contains("CreateDraftRelease")) | ||
{ | ||
if (IsReleaseBranch && string.IsNullOrEmpty(GitHubAccessToken)) | ||
errors.Add("GitHub Access Token was not set."); | ||
} | ||
|
||
if (TasksToExecute.Contains("DeployWebsite")) | ||
{ | ||
if (string.IsNullOrEmpty(GitHubUserId)) | ||
|
@@ -242,17 +256,20 @@ public class BuildParameters | |
Console.WriteLine("IsRunningOnUnix: " + IsRunningOnUnix); | ||
Console.WriteLine("IsRunningOnAppVeyor: " + IsRunningOnAppVeyor); | ||
|
||
Console.WriteLine("\nGIT"); | ||
|
||
Console.WriteLine("\nVERSIONING"); | ||
Console.WriteLine("PackageVersion: " + PackageVersion); | ||
Console.WriteLine("AssemblyVersion: " + AssemblyVersion); | ||
Console.WriteLine("AssemblyFileVersion: " + AssemblyFileVersion); | ||
Console.WriteLine("AssemblyInformationalVersion: " + AssemblyInformationalVersion); | ||
Console.WriteLine("SemVer: " + Versions.SemVer); | ||
Console.WriteLine("IsPreRelease: " + Versions.IsPreRelease); | ||
Console.WriteLine("PreReleaseLabel: " + Versions.PreReleaseLabel); | ||
Console.WriteLine("PreReleaseSuffix: " + Versions.PreReleaseSuffix); | ||
Console.WriteLine("SemVer: " + BuildVersion.SemVer); | ||
Console.WriteLine("IsPreRelease: " + BuildVersion.IsPreRelease); | ||
Console.WriteLine("PreReleaseLabel: " + BuildVersion.PreReleaseLabel); | ||
Console.WriteLine("PreReleaseSuffix: " + BuildVersion.PreReleaseSuffix); | ||
|
||
Console.WriteLine("\nRELEASING"); | ||
Console.WriteLine("BranchName: " + BranchName); | ||
Console.WriteLine("IsReleaseBranch: " + IsReleaseBranch); | ||
//Console.WriteLine("ReleaseMilestone: " + ReleaseMilestone); | ||
|
||
Console.WriteLine("\nDIRECTORIES"); | ||
Console.WriteLine("Project: " + ProjectDirectory); | ||
|
Oops, something went wrong.