diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93c0a76..df85b5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,6 @@ jobs: runs-on: windows-latest env: NugetApiKey: ${{ secrets.NugetApiKey }} - ChocoApiKey: ${{ secrets.ChocoApiKey }} steps: - uses: actions/checkout@v4 @@ -62,7 +61,6 @@ jobs: tag_name: ${{ steps.gitversion.outputs.MajorMinorPatch }} body: | PowerShellGallery: [NexuShell ](https://www.powershellgallery.com/packages/NexuShell/${{ steps.gitversion.outputs.MajorMinorPatch }}) - Chocolatey Community Repository: [NexuShell ](https://community.chocolatey.org/packages/NexuShell/${{ steps.gitversion.outputs.MajorMinorPatch }}) draft: false prerelease: ${{ github.ref != 'refs/heads/main' }} diff --git a/build.ps1 b/build.ps1 index b497ea5..cf55993 100644 --- a/build.ps1 +++ b/build.ps1 @@ -16,10 +16,6 @@ param( [Switch] $DeployToGallery, - [Parameter()] - [Switch] - $Choco, - [Parameter()] [string] $SemVer = $( @@ -86,26 +82,5 @@ process { $DeployToGallery { Publish-Module -Path "$root\Output\NexuShell" -NuGetApiKey $env:NugetApiKey } - - $Choco { - $PackageSource = Join-Path $root "src\nuget" - - $Nuspec = Get-ChildItem $PackageSource -recurse -filter *.nuspec - - Copy-Item -Path $root\LICENSE -Destination $PackageSource - Compress-Archive -Path $root\Output\* -DestinationPath $PackageSource\tools\NexuShell.zip -Force #Added force to allow local testing without shenanigans - - if (Test-Path "$PackageSource\tools\NexuShell.zip") { - choco pack $Nuspec.FullName --version $SemVer --output-directory $root - } else { - throw "Welp, ya need the zip in the tools folder, dumby" - } - - if ($env:ChocoApiKey) { - Get-ChildItem $PackageSource -Recurse -Filter *.nupkg | ForEach-Object { - choco push $_.FullName -s https://push.chocolatey.org --api-key="'$($env:ChocoApiKey)'" - } - } - } } } \ No newline at end of file diff --git a/src/nuget/NexuShell.nuspec b/src/nuget/NexuShell.nuspec deleted file mode 100644 index d72511f..0000000 --- a/src/nuget/NexuShell.nuspec +++ /dev/null @@ -1,36 +0,0 @@ - - - - - NexuShell - 1.0.0 - steviecoaster - https://github.com/steviecoaster/NexuShell/tree/develop/src/public/nuget - NexuShell - Stephen Valdinger - https://github.com/steviecoaster/NexuShell - https://github.com/steviecoaster/NexuShell - https://cdn.jsdelivr.net/gh/steviecoaster/NexuShell@develop/logo/nexushell.svg - (c) 2021 steviecoaster. All rights reserved. - https://nexushell.dev/ - https://github.com/steviecoaster/NexuShell/issues - https://raw.githubusercontent.com/steviecoaster/NexuShell/main/LICENSE - false - sonatype nexus repository powershell module - A PowerShell module for Sonatype Nexus repository server administration. - A PowerShell module for Sonatype Nexus repository server administration. - -You can pass the following parameters: - -* `/Core` - Installs the module to the PowerShell Modules directory -* `/Windows` - Installs the module to the WindowsPowerShell Modules directory -* `/CurrentUser` - Installs the module to the CurrentUser scope -* `/AllUsers` - Installs the module to the AllUsers scope - - https://github.com/steviecoaster/NexuShell/releases - - - - - - \ No newline at end of file diff --git a/src/nuget/Verification.txt b/src/nuget/Verification.txt deleted file mode 100644 index 107cfe6..0000000 --- a/src/nuget/Verification.txt +++ /dev/null @@ -1,7 +0,0 @@ -VERIFICATION - -To verify the files using the project source: - -1. Please go to the project source location (https://github.com/steviecoaster/NexuShell) and download the source files -2. Run `Requirements.ps1` (if required) and `build.ps1 -Build` to compile the module -3. Use `Get-FileHash` on the resultant psm1/psd1 to get the file hash value from both the built file (from step 1 above) and the file from the package and compare them - as they're currently not being signed before publishing, they should be identical. \ No newline at end of file diff --git a/src/nuget/tools/.skipAutoUninstaller b/src/nuget/tools/.skipAutoUninstaller deleted file mode 100644 index e69de29..0000000 diff --git a/src/nuget/tools/chocolateyBeforeModify.ps1 b/src/nuget/tools/chocolateyBeforeModify.ps1 deleted file mode 100644 index fb8c362..0000000 --- a/src/nuget/tools/chocolateyBeforeModify.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$ErrorActionPreference = 'Stop' -Remove-Module -Name $env:ChocolateyPackageName -Force -ErrorAction SilentlyContinue \ No newline at end of file diff --git a/src/nuget/tools/chocolateyInstall.ps1 b/src/nuget/tools/chocolateyInstall.ps1 deleted file mode 100644 index fa59538..0000000 --- a/src/nuget/tools/chocolateyInstall.ps1 +++ /dev/null @@ -1,75 +0,0 @@ -$ErrorActionPreference = 'Stop' - -$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition -$ModuleName = $env:ChocolateyPackageName # this may be different from the package name and different case -$ModuleVersion = $env:ChocolateyPackageVersion # this may change so keep this here -$SavedParamsPath = Join-Path $toolsDir -ChildPath 'parameters.saved' - -if ($PSVersionTable.PSVersion.Major -lt 5) { - Write-Warning "$ModuleName has not been tested on this version of PowerShell" -} - -# Module may already be installed outside of Chocolatey -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue - -# remove the saved parameters file if it exists -if (Test-Path -Path $savedParamsPath) { - Remove-Item -Path $savedParamsPath -Force -} - -$sourcePath = Join-Path $toolsDir -ChildPath "$($ModuleName).zip" -$destinationPath = @() - -$PathSegment = @{ - Windows = "WindowsPowerShell\Modules\" - Core = "PowerShell\Modules\" - - AllUsers = $env:ProgramFiles - CurrentUser = try { - $PROFILE | Split-Path | Split-Path - } catch { - Write-Warning "Profile is set to '$($PROFILE)'. Current user '$($env:USERNAME)' may not be able to install at user level." - } -} - -$Parameters = Get-PackageParameters - -if (-not $Parameters.ContainsKey('Windows') -and -not $Parameters.ContainsKey('Core')) { - $Parameters += @{ - Windows = $PSVersionTable.PSVersion.Major -le 5 - Core = $PSVersionTable.PSVersion.Major -gt 5 - } -} - -if (-not $Parameters.ContainsKey('AllUsers') -and -not $Parameters.ContainsKey('CurrentUser')) { - $Parameters += @{ - AllUsers = Test-ProcessAdminRights - CurrentUser = -not (Test-ProcessAdminRights) - } -} - -foreach ($Scope in $Parameters.Keys.Where{$Parameters[$_] -and $_ -in @("AllUsers", "CurrentUser")}) { - if ($Parameters.Windows) { - $destinationPath += Join-Path -Path $PathSegment.$Scope -ChildPath $PathSegment.Windows - } - - if ($Parameters.Core) { - $destinationPath += Join-Path -Path $PathSegment.$Scope -ChildPath $PathSegment.Core - } -} - -foreach ($destPath in $destinationPath) { - Write-Verbose "Installing '$($modulename)' to '$($destPath)'." - - # Check if the destination path exists and create if not - if (Test-Path -Path $destPath) { - $null = New-Item -Path $destPath -ItemType Directory -Force - } - Get-ChocolateyUnzip -FileFullPath $sourcePath -Destination $destPath -PackageName $moduleName - - # save the locations where the module was installed so we can uninstall it - Add-Content -Path $savedParamsPath -Value $destPath -} - -# cleanup the module from the Chocolatey $toolsDir folder -Remove-Item -Path $sourcePath -Force -Recurse \ No newline at end of file diff --git a/src/nuget/tools/chocolateyUninstall.ps1 b/src/nuget/tools/chocolateyUninstall.ps1 deleted file mode 100644 index 1a5a84a..0000000 --- a/src/nuget/tools/chocolateyUninstall.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -$ErrorActionPreference = 'Stop' - -$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition -$moduleName = $env:ChocolateyPackageName # this may be different from the package name and different case -$savedParamsPath = Join-Path $toolsDir -ChildPath 'parameters.saved' - -if (Test-Path -Path $savedParamsPath) { - $removePath = Get-Content -Path $savedParamsPath -} else { - $removePath = Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName" -} - -ForEach ($path in $removePath) { - Write-Verbose "Removing all version of '$moduleName' from '$path'." - Remove-Item -Path $path -Recurse -Force -ErrorAction SilentlyContinue -} - -# remove path of module from $env:PSModulePath -if ($PSVersionTable.PSVersion.Major -lt 4) { - $modulePaths = [Environment]::GetEnvironmentVariable('PSModulePath', 'Machine') -split ';' - - Write-Verbose "Removing '$sourcePath' from PSModulePath." - $newModulePath = $modulePaths | Where-Object { $_ -ne $sourcePath } - - [Environment]::SetEnvironmentVariable('PSModulePath', $newModulePath, 'Machine') - $env:PSModulePath = $newModulePath -} \ No newline at end of file