Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit b1275da

Browse files
updated build script to push to myget
also fixed issue when running test
1 parent b370ea3 commit b1275da

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

build.cake

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ var configuration = Argument("configuration", "Release");
55
var artifactsDir = Directory("./artifacts");
66
var srcDir = Directory("./src");
77
var solution = srcDir + File("SqlStreamStore.HAL.sln");
8-
var buildNumber = string.IsNullOrWhiteSpace(EnvironmentVariable("BUILD_NUMBER")) ? "0" : EnvironmentVariable("BUILD_NUMBER");
8+
var buildNumber = string.IsNullOrWhiteSpace(EnvironmentVariable("BUILD_NUMBER"))
9+
? "0"
10+
: EnvironmentVariable("BUILD_NUMBER");
11+
var mygetApiKey = EnvironmentVariable("MYGET_API_KEY");
912

1013
Task("Clean")
1114
.Does(() =>
@@ -30,7 +33,7 @@ Task("Build")
3033
});
3134
});
3235

33-
Task("RunTests")
36+
Task("Test")
3437
.IsDependentOn("Build")
3538
.Does(() =>
3639
{
@@ -52,7 +55,7 @@ Task("Publish")
5255
});
5356
});
5457

55-
Task("NuGetPack")
58+
Task("Package")
5659
.IsDependentOn("Build")
5760
.Does(() =>
5861
{
@@ -66,13 +69,34 @@ Task("NuGetPack")
6669
});
6770
});
6871

72+
Task("MyGetPush")
73+
.IsDependentOn("Package")
74+
.Does(() =>
75+
{
76+
if (string.IsNullOrEmpty(mygetApiKey)) {
77+
Warning("MyGet API key not available. Packages will not be pushed.");
78+
return;
79+
}
80+
81+
var files = GetFiles("artifacts/*.nupkg");
82+
foreach(var file in files) {
83+
Information(file);
84+
DotNetCoreNuGetPush(file.FullPath, new DotNetCoreNuGetPushSettings
85+
{
86+
ApiKey = EnvironmentVariable("MYGET_API_KEY"),
87+
Source = "https://www.myget.org/F/sqlstreamstore/api/v3/index.json"
88+
});
89+
}
90+
});
91+
6992
Task("Default")
70-
.IsDependentOn("RunTests")
71-
.IsDependentOn("NuGetPack");
93+
.IsDependentOn("Test")
94+
.IsDependentOn("MyGetPush");
7295

7396
RunTarget(target);
7497

7598
Action RunTest(string testProject) => () => DotNetCoreTest(srcDir + Directory(testProject), new DotNetCoreTestSettings {
7699
NoBuild = true,
77-
NoRestore = true
78-
});
100+
NoRestore = true,
101+
Configuration = configuration
102+
});

0 commit comments

Comments
 (0)