1
+ using NuGetPush . Tasks . Extensions ;
2
+
1
3
namespace NuGetPush . Tasks ;
2
4
3
5
public class PushPackage : NuGetPackageTaskBase
4
6
{
5
7
public PushPackage ( ResourceManager taskResources , string helpKeywordPrefix ) : base ( taskResources , helpKeywordPrefix ) { }
6
8
public PushPackage ( ) : base ( ) { }
7
9
10
+ public string PackageId => PackagePath . GetPackageId ( ) ;
11
+
12
+ public string PackageVersion => PackagePath . GetPackageVersion ( ) ;
13
+
8
14
[ Required ]
9
15
public string PackagePath { get ; set ; }
10
16
public override bool Execute ( )
@@ -14,7 +20,15 @@ public override bool Execute()
14
20
return false ;
15
21
}
16
22
17
- PushRunner . Run ( Settings , PackageSourceProvider , [ PackagePath ] , Source , ApiKey , null , null , 10 , false , true , false , true , Logger ) ;
23
+ Logger . LogWarning ( $ "Pushing { PackageId } version { PackageVersion } to source { Source } ...") ;
24
+ // PushRunner.Run(Settings, PackageSourceProvider, [PackagePath], Source, ApiKey, null, null, 10, false, true, false, true, Logger);
25
+ List < string > args = [ "nuget" , "push" , PackagePath , "-s" , Source ] ;
26
+ if ( ! IsNullOrEmpty ( ApiKey ) )
27
+ {
28
+ args . AddRange ( [ "-k" , ApiKey ] ) ;
29
+ }
30
+ var psi = new ProcessStartInfo ( "dotnet" , args ) ;
31
+ Process . Start ( psi ) . WaitForExit ( ) ;
18
32
return true ;
19
33
}
20
34
0 commit comments