forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Improve versioning and allow upload to nuget.org (MonoGame#8447)
* [CI] Improve versioning and allow upload to nuget.org * [CI] Take president with using tag as version * [CI] Quick tag check fix * [CI] Skip picking up build number and fully use the tag version
- Loading branch information
Showing
5 changed files
with
81 additions
and
7 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
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,31 @@ | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName("DeployNuGetsToNuGetOrgTask")] | ||
[IsDependentOn(typeof(DownloadArtifactsTask))] | ||
public sealed class DeployNuGetsToNuGetOrgTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) | ||
{ | ||
if (context.BuildSystem().IsRunningOnGitHubActions) | ||
{ | ||
var workflow = context.BuildSystem().GitHubActions.Environment.Workflow; | ||
if (workflow.RefType == GitHubActionsRefType.Tag && | ||
!string.IsNullOrWhiteSpace(context.EnvironmentVariable("NUGET_API_KEY"))) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
context.DotNetNuGetPush($"nugets/*.nupkg", new() | ||
{ | ||
ApiKey = context.EnvironmentVariable("NUGET_API_KEY"), | ||
Source = $"https://api.nuget.org/v3/index.json" | ||
}); | ||
} | ||
} |
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