-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making this dynamic and based on the NuGet.config file!
- Loading branch information
Showing
31 changed files
with
993 additions
and
1,424 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1154,3 +1154,6 @@ $RECYCLE.BIN/ | |
*site/* | ||
js/ | ||
.npmrc | ||
|
||
lib/ | ||
nupkg/ |
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,55 @@ | ||
$nupkgRegex = "^(?:.*/)?(?<PackageId>.+)\.(?<Version>(?<Major>\d+)\.(?<Minor>\d+)\.(?<Build>\d+)(?:-(?<Prerelease>[\w.-]+))?)\.nupkg$" | ||
|
||
function Get-PackageId { | ||
[CmdletBinding()] | ||
param ( | ||
[string]$PackagePath | ||
) | ||
process { | ||
if ($PackagePath -match $nupkgRegex) { | ||
return $matches["PackageId"] | ||
} | ||
else { | ||
Write-Error "The package path does not match the expected pattern." | ||
} | ||
} | ||
} | ||
|
||
function Get-PackageVersion { | ||
[CmdletBinding()] | ||
param ( | ||
[string]$PackagePath | ||
) | ||
process { | ||
if ($PackagePath -match $nupkgRegex) { | ||
return $matches["Version"] | ||
} | ||
else { | ||
Write-Error "The package path does not match the expected pattern." | ||
} | ||
} | ||
} | ||
|
||
function Push-Package { | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$PackagePath, | ||
[Parameter(Mandatory = $false)] | ||
[string]$Source = "nuget.org", | ||
[Parameter(Mandatory = $false)] | ||
[string]$ApiKey | ||
) | ||
process { | ||
if (-not $ApiKey) { | ||
$ApiKey = $env:API_KEY | ||
} | ||
if (-not $ApiKey) { | ||
throw "ApiKey is required" | ||
} | ||
yes | dotnet nuget delete Get-PackageId $PackagePath Get-PackageVersion $PackagePath --source $Source --api-key $ApiKey -y | ||
dotnet nuget push $PackagePath --api-key $ApiKey --source $Source | ||
} | ||
} | ||
|
||
Push-Package -PackagePath $args[0] -Source $args[1] -ApiKey $args[2] |
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,55 @@ | ||
#!/bin/bash | ||
|
||
# Define the regex pattern for .nupkg files | ||
nupkgRegex='^(?:.*/)?(.+)\.([0-9]+\.[0-9]+\.[0-9]+(?:-[\w.-]+)?)\.nupkg$' | ||
|
||
# Function to get the Package ID | ||
function Get_PackageId { | ||
local packagePath="$1" | ||
if [[ $packagePath =~ $nupkgRegex ]]; then | ||
echo "${BASH_REMATCH[1]}" | ||
else | ||
echo "The package path does not match the expected pattern." >&2 | ||
return 1 | ||
fi | ||
} | ||
|
||
# Function to get the Package Version | ||
function Get_PackageVersion { | ||
local packagePath="$1" | ||
if [[ $packagePath =~ $nupkgRegex ]]; then | ||
echo "${BASH_REMATCH[2]}" | ||
else | ||
echo "The package path does not match the expected pattern." >&2 | ||
return 1 | ||
fi | ||
} | ||
|
||
# Function to push the package | ||
function Push_Package { | ||
local packagePath="$1" | ||
local source="${2:-nuget.org}" | ||
local apiKey="${3:-$API_KEY}" | ||
|
||
if [ -z "$apiKey" ]; then | ||
echo "ApiKey is required" >&2 | ||
return 1 | ||
fi | ||
|
||
local packageId | ||
local packageVersion | ||
|
||
packageId=$(Get_PackageId "$packagePath") | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
packageVersion=$(Get_PackageVersion "$packagePath") | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
|
||
yes | dotnet nuget delete "$packageId" "$packageVersion" --source "$source" --api-key "$apiKey" -y | ||
dotnet nuget push "$packagePath" --api-key "$apiKey" --source "$source" | ||
} | ||
|
||
Push_Package "$1" "$2" "$3" |
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 |
---|---|---|
@@ -1,13 +1,10 @@ | ||
<!-- | ||
* Sdk.props | ||
* | ||
* Created: 2022-11-27-05:39:27 | ||
* Modified: 2022-12-05-04:12:36 | ||
* | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* | ||
* Copyright © 2022-2023 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
* Created: 2023-02-25T23:13:13-05:00 | ||
* Modified: 2024-08-03T17:43:22-04:00 | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* Copyright: © 2022 - 2024 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
--> | ||
|
||
<Project> | ||
|
@@ -21,10 +18,23 @@ | |
<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> | ||
<NuGetPushDll Condition="'$(NuGetPushDll)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../lib/NuGetPush.dll'))</NuGetPushDll> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<NuGetPushAzureArtifactsIsEnabled Condition="'$(NuGetPushAzureArtifactsIsEnabled)' == ''">true</NuGetPushAzureArtifactsIsEnabled> | ||
<NuGetPushFaGetIsEnabled Condition="'$(NuGetPushFaGetIsEnabled)' == ''">true</NuGetPushFaGetIsEnabled> | ||
<NuGetPushLiGetIsEnabled Condition="'$(NuGetPushLiGetIsEnabled)' == ''">true</NuGetPushLiGetIsEnabled> | ||
<NuGetPushGitHubIsEnabled Condition="'$(NuGetPushGitHubIsEnabled)' == ''">true</NuGetPushGitHubIsEnabled> | ||
<NuGetPushLocalIsEnabled Condition="'$(NuGetPushLocalIsEnabled)' == ''">true</NuGetPushLocalIsEnabled> | ||
</PropertyGroup> | ||
<UsingTask TaskName="NuGetPush.Tasks.PushPackage" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<UsingTask TaskName="NuGetPush.Tasks.DeletePackage" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<UsingTask TaskName="NuGetPush.Tasks.DeleteAndPush" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<UsingTask TaskName="NuGetPush.Tasks.GetNuGetApiKey" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<UsingTask TaskName="NuGetPush.Tasks.GetNuGetSources" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<UsingTask TaskName="NuGetPush.Tasks.GenerateDynamicTargets" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<UsingTask TaskName="NuGetPush.Tasks.DetermineIfPackageExists" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
<PropertyGroup> | ||
<DynamicTargetsProjectFile Condition="'$(DynamicTargetsProjectFile)' == ''">$([MSBuild]::EnsureTrailingSlash($(MSBuildProjectDirectory)))$([MSBuild]::EnsureTrailingSlash($(IntermediateOutputPath)))NuGet.Dynamic.targets</DynamicTargetsProjectFile> | ||
</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> |
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
<!-- | ||
* Sdk.targets | ||
* | ||
* Created: 2022-11-27-05:39:27 | ||
* Modified: 2022-12-05-04:12:25 | ||
* | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* | ||
* Copyright © 2022-2023 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
* Created: 2023-02-25T23:13:13-05:00 | ||
* Modified: 2024-08-03T17:43:14-04:00 | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* Copyright: © 2022 - 2024 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
--> | ||
|
||
<Project> | ||
<Import Project="$(MSBuildThisFileDirectory)../Targets/*.targets" /> | ||
<Import Project="$(MSBuildThisFileDirectory)../Targets/Dynamic.targets" /> | ||
<Import Project="$(MSBuildThisFileDirectory)../Targets/PackageExists.targets" /> | ||
</Project> |
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,34 @@ | ||
<!-- | ||
* Dynamic.targets | ||
* Created: 2024-07-28T20:14:36-04:00 | ||
* Modified: 2024-07-28T20:14:37-04:00 | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* Copyright: © 2022 - 2024 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
--> | ||
|
||
<Project> | ||
<UsingTask TaskName="NuGetPush.Tasks.GenerateDynamicTargets" AssemblyFile="$(NuGetPushDll)" Condition="Exists($(NuGetPushDll))" /> | ||
|
||
<Target Name="GenerateDynamicTargets" AfterTargets="Pack" DependsOnTargets="Pack;GetPackageTargetPath;SetPackageExists"> | ||
<Message Text="Generating temporary targets file..." Importance="high" /> | ||
|
||
<GenerateDynamicTargets PackagePath="$(PackageTargetPath)" ProjectFile="$(MSBuildProjectFullPath)" DynamicTargetsProjectFile="$(DynamicTargetsProjectFile)" /> | ||
|
||
<Warning Text="Generated temporary targets file: $(DynamicTargetsProjectFile)" /> | ||
<Warning Text="MSBuildProjectFullPath: $(MSBuildProjectFullPath)" /> | ||
|
||
<GetNuGetSources ProjectFile="$(MSBuildProjectFullPath)"> | ||
<Output TaskParameter="NuGetSources" ItemName="NuGetSource" /> | ||
</GetNuGetSources> | ||
|
||
<Warning Text="NuGet sources: @(NuGetSource->'%(Name)', ', ')" /> | ||
</Target> | ||
|
||
<Import Project="$(DynamicTargetsProjectFile)" Condition="Exists($(DynamicTargetsProjectFile))" /> | ||
|
||
<Target Name="DeleteTemporaryTargetsFile" AfterTargets="AfterBuild,Compile" DependsOnTargets="AfterBuild"> | ||
<Message Text="Deleting temporary targets file..." Importance="high" /> | ||
<Delete Files="$(DynamicTargetsProjectFile)" /> | ||
</Target> | ||
</Project> |
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,17 @@ | ||
<!-- | ||
* PackageExists.props | ||
* Created: 2024-08-02T03:38:56-04:00 | ||
* Modified: 2024-08-02T03:38:57-04:00 | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* Copyright: © 2022 - 2024 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
--> | ||
|
||
<Project> | ||
<Target Name="SetPackageExists" DependsOnTargets="Pack" AfterTargets="Pack"> | ||
<PropertyGroup> | ||
<PackageExists Condition="Exists($(PackageTargetPath))">true</PackageExists> | ||
<PackageExists Condition="!Exists($(PackageTargetPath))">false</PackageExists> | ||
</PropertyGroup> | ||
</Target> | ||
</Project> |
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,20 @@ | ||
<!-- | ||
* PushBaGet.targets | ||
* Created: 2024-07-28T19:26:00-04:00 | ||
* Modified: 2024-07-28T19:26:00-04:00 | ||
* Author: David G. Moore, Jr. <[email protected]> | ||
* Copyright: © 2022 - 2024 David G. Moore, Jr., All Rights Reserved | ||
* License: MIT (https://opensource.org/licenses/MIT) | ||
--> | ||
|
||
<Project> | ||
<Target Name="PushFaGet" DependsOnTargets="Pack;MinVer;SetPackageExists" Condition="'$(GeneratePackageOnBuild)' == 'true'"> | ||
<DeletePackage PackageId="$(PackageId)" PackageVersion="$(PackageVersion)" Source="FaGet" ProjectFile="$(MSBuildProjectFullPath)" /> | ||
<PushPackage PackagePath="$(PackageTargetPath)" Source="FaGet" ProjectFile="$(MSBuildProjectFullPath)" /> | ||
<!-- <Warning Text="Deleting package $(PackageId) version $(PackageVersion) from FaGet..." /> | ||
<Exec Command="echo 'y' | dotnet nuget delete $(PackageId) $(PackageVersion) -s FaGet -k $(BAGET_API_KEY)" IgnoreExitCode="true" /> | ||
<Exec Command="pwsh -Command Read-Host" /> | ||
<Warning Text="Pushing package $(PackageId) version $(PackageVersion) to FaGet..." /> | ||
<Exec Command="dotnet nuget push '$(PackageTargetPath)' -s FaGet -k $(BAGET_API_KEY)" Condition="Exists('$(PackageTargetPath)')" /> --> | ||
</Target> | ||
</Project> |
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
Oops, something went wrong.