Skip to content

Commit be4d47f

Browse files
committed
(GH-52) Added pre-release parameter
- Allow the user to specify whether the generated release is a pre-release or not
1 parent 1653715 commit be4d47f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Source/GitHubReleaseManager.Cli/Options/CreateSubOptions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ public class CreateSubOptions : BaseGitHubSubOptions
2626

2727
[Option('i', "inputFilePath", HelpText = "The path to the file to be used as the content of the release notes.", Required = false)]
2828
public string InputFilePath { get; set; }
29+
30+
[Option('e', "pre", Required = false, HelpText = "Creates the release as a pre-release.")]
31+
public bool PreRelease { get; set; }
2932
}
3033
}

Source/GitHubReleaseManager.Cli/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private static async Task<int> ExportReleasesAsync(ExportSubOptions subOptions,
227227
}
228228
}
229229

230-
private static async Task CreateReleaseFromMilestone(GitHubClient github, string owner, string repository, string milestone, string targetCommitish, IList<string> assets, Config configuration)
230+
private static async Task CreateReleaseFromMilestone(GitHubClient github, string owner, string repository, string milestone, string targetCommitish, IList<string> assets, bool preRelease, Config configuration)
231231
{
232232
var releaseNotesBuilder = new ReleaseNotesBuilder(new DefaultGitHubClient(github, owner, repository), owner, repository, milestone, configuration);
233233

@@ -237,7 +237,8 @@ private static async Task CreateReleaseFromMilestone(GitHubClient github, string
237237
{
238238
Draft = true,
239239
Body = result,
240-
Name = milestone
240+
Name = milestone,
241+
Prerelease = preRelease
241242
};
242243

243244
if (!string.IsNullOrEmpty(targetCommitish))
@@ -265,7 +266,7 @@ private static async Task CreateReleaseFromMilestone(GitHubClient github, string
265266
}
266267
}
267268

268-
private static async Task CreateReleaseFromInputFile(GitHubClient github, string owner, string repository, string name, string inputFilePath, string targetCommitish, IList<string> assets, Config configuration)
269+
private static async Task CreateReleaseFromInputFile(GitHubClient github, string owner, string repository, string name, string inputFilePath, string targetCommitish, IList<string> assets, bool preRelease, Config configuration)
269270
{
270271
if (!File.Exists(inputFilePath))
271272
{
@@ -278,7 +279,8 @@ private static async Task CreateReleaseFromInputFile(GitHubClient github, string
278279
{
279280
Draft = true,
280281
Body = inputFileContents,
281-
Name = name
282+
Name = name,
283+
Prerelease = preRelease
282284
};
283285

284286
if (!string.IsNullOrEmpty(targetCommitish))

0 commit comments

Comments
 (0)