Skip to content

Commit

Permalink
Working on these
Browse files Browse the repository at this point in the history
  • Loading branch information
dgmjr committed Feb 4, 2024
1 parent 8dce458 commit f6b557d
Show file tree
Hide file tree
Showing 22 changed files with 1,750 additions and 66 deletions.
30 changes: 15 additions & 15 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
date: 2023-07-13T05:44:46.048Z
date: 2023-07-13T05:44:46:00-05:00Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
liimitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51.216Z
- include-copyright
limitations:
- liability
- warranty
lastmod: 2024-01-0T00:39:00.0000+05:00Z
license: MIT
slug: mit-license
title: MIT License
Expand All @@ -25,7 +25,7 @@ type: license

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved
## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
24 changes: 21 additions & 3 deletions NuGetPush.nuproj → NuGetPush.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* License: MIT (https://opensource.org/licenses/MIT)
-->

<Project Sdk="Microsoft.Build.NoTargets">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="./Sdk/Sdk.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
Expand All @@ -20,10 +21,15 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsNuGetized>true</IsNuGetized>
<ProjectGuid>2498EED9-9158-41BD-9D4A-246A70A1D9E2</ProjectGuid>
<EmitNuspec>true</EmitNuspec>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputPath>lib/</OutputPath>
</PropertyGroup>
<ItemGroup>
<Content Include="./Sdk/*" PackagePath="Sdk/%(Filename)%(Extension)" />
<Content Include="./Scripts/**/*" PackagePath="Scripts/%(RecursiveDir)%(Filename)%(Extension)" />
<PackageFile Include="./Sdk/*" PackagePath="Sdk/%(Filename)%(Extension)" />
<PackageFile Include="./Targets/**/*" PackagePath="Targets/%(Filename)%(Extension)" />
<PackageFile Include="./Scripts/**/*" PackagePath="Scripts/%(RecursiveDir)%(Filename)%(Extension)" />
<PackageFile Include="$(OutputPath)$(TargetFramework)/*.*" PackagePath="lib/%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageTag Include="GitHub" />
Expand All @@ -34,10 +40,22 @@
<PackageTag Include="NuGet-Push" />
<PackageTag Include="Packaging" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSBuild.Usings" IncludeAssets="Build;BuildTransitive;BuildMultitargeting;Runtime;Compile" ExcludeAssets="ContentFiles;Native;Analyzers" PrivateAssets="None" />
<PackageReference Include="NuGet.Protocol" />
<PackageReference Include="NuGet.Commands" />
</ItemGroup>
<ItemGroup>
<Compile Remove="./TestPush/**/*.cs" />
</ItemGroup>
<!-- <ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" VersionOverride="4.0.0" />
</ItemGroup> -->
<Target Name="BuildTypeScript" AfterTargets="Build">
<Exec Command="tsc" WorkingDirectory="./Scripts" />
</Target>
<Target Name="CleanJSOutput" AfterTargets="Clean">
<Delete Files="$(MSBuildThisFileDirectory)Scripts/js/*" />
</Target>
<Import Project="./Sdk/Sdk.targets" />
</Project>
17 changes: 16 additions & 1 deletion NuGetPush.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props
..\..\..\Directory.Build.targets = ..\..\..\Directory.Build.targets
..\..\..\global.json = ..\..\..\global.json
..\..\..\Packages\Versions.Local.props = ..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGetPush", "NuGetPush.csproj", "{2498EED9-9158-41BD-9D4A-246A70A1D9E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Local|Any CPU = Local|Any CPU
Expand All @@ -17,6 +20,18 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Local|Any CPU.ActiveCfg = Local|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Local|Any CPU.Build.0 = Local|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Testing|Any CPU.Build.0 = Testing|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Staging|Any CPU.Build.0 = Staging|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Production|Any CPU.ActiveCfg = Local|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Production|Any CPU.Build.0 = Local|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2498EED9-9158-41BD-9D4A-246A70A1D9E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
10 changes: 10 additions & 0 deletions NuGetPush.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<ItemGroup>
<PackageFile Remove="@(PackageFile->WithMetadataValue('PackagePath', 'README.md'))" />
<Content Remove="@(Content)" />
<None Remove="@(None)" />
<PackageFile Include="icon.png" PackagePath="icon.png" />
<PackageFile Include="./bin/Local/netstandard2.0/*.*" PackagePath="$(TargetFramework)/%(Filename)%(Extension)" />
<PackageFile Include="./Sdk/*.*" PackagePath="Sdk/%(Filename)%(Extension)" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions Sdk/Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@
<NuGetConfigFile>$(MSBuildThisFileDirectory)../NuGet.config</NuGetConfigFile>
<DeleteGitHubPackageVersionScriptName>$(MSBuildThisFileDirectory)../Scripts/delete-github-package-version</DeleteGitHubPackageVersionScriptName>
<GitHubOrg />
<!-- <NuGetPushDll Condition="'$(MSBuildProjectName)' == 'NuGetPush'">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../bin/Local/netstandard2.0/NuGetPush.dll'))</NuGetPushDll>
<NuGetPushDll Condition="'$(MSBuildProjectName)' != 'NuGetPush'">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../lib/netstandard2.0/NuGetPush.dll'))</NuGetPushDll> -->
<NuGetPushDll>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../lib/netstandard2.0/NuGetPush.dll'))</NuGetPushDll>
</PropertyGroup>
<UsingTask TaskName="NuGetPush.Tasks.Push" AssemblyFile="$(NuGetPushDll)" />
<UsingTask TaskName="NuGetPush.Tasks.DeletePackage" AssemblyFile="$(NuGetPushDll)" />
<UsingTask TaskName="NuGetPush.Tasks.DeleteAndPush" AssemblyFile="$(NuGetPushDll)" />
<UsingTask TaskName="NuGetPush.Tasks.GetNuGetApiKey" AssemblyFile="$(NuGetPushDll)" />
</Project>
48 changes: 1 addition & 47 deletions Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,5 @@
-->

<Project>
<Target Name="PushAzure" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<Exec Command="nuget search $(PackageId) -s Azure -noninteractive | grep $(PackageVersion)" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PackageExists" />
</Exec>
<Exec Command="echo 'Deleting package $(PackageId) $(PackageVersion) from Azure...';" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s Azure --non-interactive -k 'az'" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s Azure -k 'az' --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" />
</Target>

<Target Name="PushProGetPrerelease" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<!-- <Exec Command="echo 'Deleting package $(PackageId) $(PackageVersion) from ProGet...';" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" /> -->
<!-- <Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s ProGetPrerelease --non-interactive -k '$env:PROGET_API_KEY'" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" /> -->
<Exec Command="dotnet nuget push $(PackageTargetPath) -s ProGet -k '$env:PROGET_API_KEY' --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" />
</Target>

<Target Name="PushProGet" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<!-- <Exec Command="echo 'Deleting package $(PackageId) $(PackageVersion) from ProGet...';" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" /> -->
<!-- <Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s ProGet --non-interactive -k '$env:PROGET_API_KEY'" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" /> -->
<Exec Command="pwsh -Command %22dotnet nuget push $(PackageTargetPath) -s ProGet -k '$env:PROGET_API_KEY' --skip-duplicate%22" Condition="Exists('$(PackageTargetPath)')" />
</Target>

<Target Name="EnsureGitHubToken" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<Exec Command="gh auth token" ConsoleToMSBuild="true" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitHubAuthToken" />
</Exec>
<Error Condition="'$(GitHubAuthToken)' == '' Or '$(GitHubAuthToken)' == 'undefined'" Text="You must first set the GitHub auth token by running 'gh auth login'" Code="GHPUSH001" HelpLink="https://cli.github.com/manual/gh_auth_login" />
</Target>

<Target Name="PushGitHub" DependsOnTargets="EnsureGitHubToken" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<PropertyGroup>
<DeleteGitHubPackageVersionScript>$(DeleteGitHubPackageVersionScriptName) --org "dgmjr-io" -i "$(PackageId)" -v "$(PackageVersion)" --t nuget --token "$(GitHubAuthToken)"</DeleteGitHubPackageVersionScript>
</PropertyGroup>
<Message Text="echo 'DeleteGitHubPackageVersionScript: $(DeleteGitHubPackageVersionScript)' " />
<Exec Command="$(DeleteGitHubPackageVersionScript)" ContinueOnError="true" IgnoreExitCode="true" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s GitHub -k $(GitHubAuthToken) --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" IgnoreExitCode="true" />
</Target>

<Target Name="PushLocal" AfterTargets="Pack" DependsOnTargets="Pack;GetPackageVersion" Condition="'$(GeneratePackageOnBuild)' == 'true' And '$(DesignTimeBuild)' != 'true' And ('$(Configuration)' == 'Local' Or $(InitialTargets.Contains('PushLocal')))">
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s Local --non-interactive" ContinueOnError="true" IgnoreExitCode="true" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s Local --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" IgnoreExitCode="true" />
</Target>
<Import Project="../Targets/*.targets" Condition="'$(MSBuildProjectName)' != 'NuGetPush'" />
</Project>
12 changes: 12 additions & 0 deletions Targets/PushAzure.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project>
<Target Name="PushAzure" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<Exec Command="nuget search $(PackageId) -s Azure -noninteractive | grep $(PackageVersion)" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PackageExists" />
</Exec>
<Exec Command="echo 'Deleting package $(PackageId) $(PackageVersion) from Azure...';" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s Azure --non-interactive -k 'az'" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s Azure -k 'az' --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" />
</Target>
</Project>
20 changes: 20 additions & 0 deletions Targets/PushFeedz.io.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<Target Name="PushFeedzio" AfterTargets="Pack" DependsOnTargets="Pack;GetPackageVersion" Condition="'$(GeneratePackageOnBuild)' == 'true' And '$(DesignTimeBuild)' != 'true' And ('$(Configuration)' == 'Local' Or $(InitialTargets.Contains('PushLocal')))">
<NuGetPush.Tasks.GetNuGetApiKey
Source="Feedz.io"
MSBuildProjectDirectory="$(MSBuildProjectDirectory)">
<Output TaskParameter="ApiKey" PropertyName="FEEDZ_IO_API_KEY" />
</NuGetPush.Tasks.GetNuGetApiKey>
<!-- <Message Text="FEEDZ_IO_API_KEY: $(FEEDZ_IO_API_KEY)" Importance="high" /> -->
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s Feedz.io --non-interactive -k:$(FEEDZ_IO_API_KEY)" ContinueOnError="true" IgnoreExitCode="true" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s Feedz.io --skip-duplicate -k:$(FEEDZ_IO_API_KEY)" Condition="Exists('$(PackageTargetPath)')" IgnoreExitCode="true" />
<!-- <Warning Text="Deleting package $(PackageId), version $(PackageVersion) from Feedz.io and pushing a new version..." />
<NuGetPush.Tasks.DeleteAndPush
Source="Feedz.io"
MSBuildProjectDirectory="$(MSBuildProjectDirectory)"
ApiKey="$(FEEDZ_IO_API_KEY)"
PackageId="$(PackageId)"
Version="$(PackageVersion)"
PackagePath="$(PackageTargetPath)" /> -->
</Target>
</Project>
17 changes: 17 additions & 0 deletions Targets/PushGitHub.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<Target Name="EnsureGitHubToken" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<Exec Command="gh auth token" ConsoleToMSBuild="true" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitHubAuthToken" />
</Exec>
<Error Condition="'$(GitHubAuthToken)' == '' Or '$(GitHubAuthToken)' == 'undefined'" Text="You must first set the GitHub auth token by running 'gh auth login'" Code="GHPUSH001" HelpLink="https://cli.github.com/manual/gh_auth_login" />
</Target>

<Target Name="PushGitHub" DependsOnTargets="EnsureGitHubToken" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<PropertyGroup>
<DeleteGitHubPackageVersionScript>$(DeleteGitHubPackageVersionScriptName) --org "dgmjr-io" -i "$(PackageId)" -v "$(PackageVersion)" --t nuget --token "$(GitHubAuthToken)"</DeleteGitHubPackageVersionScript>
</PropertyGroup>
<Message Text="echo 'DeleteGitHubPackageVersionScript: $(DeleteGitHubPackageVersionScript)' " />
<Exec Command="$(DeleteGitHubPackageVersionScript)" ContinueOnError="true" IgnoreExitCode="true" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s GitHub -k $(GitHubAuthToken) --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" IgnoreExitCode="true" />
</Target>
</Project>
14 changes: 14 additions & 0 deletions Targets/PushLocal.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<Target Name="PushLocal" AfterTargets="Pack" DependsOnTargets="Pack;GetPackageVersion" Condition="'$(GeneratePackageOnBuild)' == 'true' And '$(DesignTimeBuild)' != 'true' And ('$(Configuration)' == 'Local' Or $(InitialTargets.Contains('PushLocal')))">
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s Local --non-interactive" ContinueOnError="true" IgnoreExitCode="true" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s Local --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" IgnoreExitCode="true" />
<!-- <NuGetPush.Tasks.DeleteAndPush
Source="Local"
MSBuildProjectDirectory="$(MSBuildProjectDirectory)"
ApiKey=""
PackageId="$(PackageId)"
Version="$(PackageVersion)"
PackagePath="$(PackageTargetPath)" /> -->
</Target>
</Project>

9 changes: 9 additions & 0 deletions Targets/PushProGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<Target Name="PushProGet" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'">
<Exec Command="echo 'Deleting package $(PackageId) $(PackageVersion) from ProGet...';" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s ProGet --non-interactive -k '$env:PROGET_API_KEY'" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="pwsh -Command %22dotnet nuget push $(PackageTargetPath) -s ProGet -k '$env:PROGET_API_KEY' --skip-duplicate%22" Condition="Exists('$(PackageTargetPath)')" />
</Target>
</Project>
9 changes: 9 additions & 0 deletions Targets/PushProGetPrerelease.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<Target Name="PushProGetPrerelease" DependsOnTargets="Pack;MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true' And false">
<Exec Command="echo 'Deleting package $(PackageId) $(PackageVersion) from ProGet...';" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget delete $(PackageId) $(PackageVersion) -s ProGetPrerelease --non-interactive -k '$env:PROGET_API_KEY'" IgnoreExitCode="true"
Condition="'$(PackageExists)' != ''" />
<Exec Command="dotnet nuget push $(PackageTargetPath) -s ProGet -k '$env:PROGET_API_KEY' --skip-duplicate" Condition="Exists('$(PackageTargetPath)')" />
</Target>
</Project>
30 changes: 30 additions & 0 deletions Tasks/Delete.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace NuGetPush.Tasks;
using MSBTask = Microsoft.Build.Utilities.Task;
using NuGet.Configuration;
using NuGet.Protocol;
using System.Resources;

using NuGetSettings = NuGet.Configuration.Settings;
using Microsoft.Build.Framework;

using NuGet.Commands;

public class DeletePackage : NuGetTaskBase
{
public DeletePackage(ResourceManager taskResources, string helpKeywordPrefix) : base(taskResources, helpKeywordPrefix) { }
public DeletePackage() : base() { }

[Required]
public string PackageId { get; set; }

[Required]
public string Version { get; set; }

public override bool Execute()
{
// Logger.LogWarning($"Deleting {PackageId} version {Version} from source {Source}...");
DeleteRunner.Run(Settings, PackageSourceProvider, PackageId, Version, Source, ApiKey, true, false, (string s) => true, Logger);
// Logger.LogWarning($"Done.");
return true;
}
}
28 changes: 28 additions & 0 deletions Tasks/DeleteAndPush.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace NuGetPush.Tasks;
using MSBTask = Microsoft.Build.Utilities.Task;
using NuGet.Configuration;
using NuGet.Protocol;
using System.Resources;

using NuGetSettings = NuGet.Configuration.Settings;
using Microsoft.Build.Framework;

using NuGet.Commands;

public class DeleteAndPush : NuGetTaskBase
{
[Required]
public string PackageId { get; set; }
[Required]
public string PackagePath { get; set; }

[Required]
public string Version { get; set; }

public override bool Execute()
{
new DeletePackage(TaskResources, HelpKeywordPrefix) { Source = Source, ApiKey = this.ApiKey, PackageId = PackageId, Version = Version, MSBuildProjectDirectory = MSBuildProjectDirectory }.Execute();
new Push(TaskResources, HelpKeywordPrefix) { Source = Source, ApiKey = ApiKey, PackagePath = PackagePath, MSBuildProjectDirectory = MSBuildProjectDirectory }.Execute();
return true;
}
}
Loading

0 comments on commit f6b557d

Please sign in to comment.