Skip to content

Commit

Permalink
feat: support pre-release packages
Browse files Browse the repository at this point in the history
Allow creating pre-release nuget packages by appending e.g. "-pre.1" to the tag
  • Loading branch information
vbreuss committed Jan 30, 2025
1 parent 9f8f2c4 commit 803a7ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on:
push:
branches: [ main ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]

jobs:
unit-tests:
Expand Down
15 changes: 13 additions & 2 deletions Pipeline/Build.Compile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,27 @@ partial class Build
.DependsOn(CalculateNugetVersion)
.Executes(() =>
{
string preRelease = "-CI";
if (GitHubActions == null)
{
preRelease = "-DEV";
}
else if (GitHubActions.Ref.StartsWith("refs/tags/", StringComparison.OrdinalIgnoreCase))
{
int preReleaseIndex = GitHubActions.Ref.IndexOf('-');
preRelease = preReleaseIndex > 0 ? GitHubActions.Ref[preReleaseIndex..] : "";
}

ReportSummary(s => s
.WhenNotNull(SemVer, (summary, semVer) => summary
.AddPair("Version", semVer)));
.AddPair("Version", semVer + preRelease)));

DotNetBuild(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.EnableNoLogo()
.EnableNoRestore()
.SetVersion(SemVer)
.SetVersion(SemVer + preRelease)
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion));
Expand Down

0 comments on commit 803a7ea

Please sign in to comment.