@@ -5,7 +5,10 @@ var configuration = Argument("configuration", "Release");
55var artifactsDir = Directory ( "./artifacts" ) ;
66var srcDir = Directory ( "./src" ) ;
77var 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
1013Task ( "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+
6992Task ( "Default" )
70- . IsDependentOn ( "RunTests " )
71- . IsDependentOn ( "NuGetPack " ) ;
93+ . IsDependentOn ( "Test " )
94+ . IsDependentOn ( "MyGetPush " ) ;
7295
7396RunTarget ( target ) ;
7497
7598Action 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