[Setup] Updated the scripts to create/push the NuGet/Chocolatey packages.
- [Change] The binaries added to the packages are now downloaded from the
github release.
- [Change] Redis.nuspec: don't copy the files from the "documentation" folder
since the documentation is already included in the source folder
along with the binaries.
- [Fix] PullBinaries.ps1: replaced hardcoded Redis version number with input
parameter.
- [Fix] Improved error handling.
This commit is contained in:
@@ -1,25 +1,36 @@
|
||||
$CurDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ChocolateyDir = $CurDir + "\chocolatey"
|
||||
$NugetDir = $CurDir + "\nuget"
|
||||
$PackagesDir = $CurDir + "\packages"
|
||||
$CurDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$PackagesDir = $CurDir + "\packages"
|
||||
$ChocolateySrcDir = $CurDir + "\chocolatey"
|
||||
$ChocolateyDestDir = $PackagesDir + "\chocolatey"
|
||||
$NugetSrcDir = $CurDir + "\nuget"
|
||||
$NugetDestDir = $PackagesDir + "\nuget"
|
||||
|
||||
If (Test-Path $PackagesDir){
|
||||
Remove-Item $PackagesDir -recurse | Out-Null
|
||||
}
|
||||
New-Item $PackagesDir -type directory | Out-Null
|
||||
New-Item ($PackagesDir+"\Chocolatey") -type directory | Out-Null
|
||||
New-Item ($PackagesDir+"\NuGet") -type directory | Out-Null
|
||||
New-Item $PackagesDir -type directory | Out-Null
|
||||
New-Item $ChocolateyDestDir -type directory | Out-Null
|
||||
New-Item $NugetDestDir -type directory | Out-Null
|
||||
|
||||
Set-Location $ChocolateyDir
|
||||
Set-Location $ChocolateySrcDir
|
||||
invoke-expression "chocolatey pack Redis.nuspec"
|
||||
Copy-Item *.nupkg ..\packages\Chocolatey
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Copy-Item *.nupkg $ChocolateyDestDir
|
||||
Write-Host "Chocolatey package copied to the destination folder." -foregroundcolor black -backgroundcolor green
|
||||
} else {
|
||||
Write-Host "FAILED to create the Chocolatey package." -foregroundcolor white -backgroundcolor red
|
||||
}
|
||||
|
||||
Set-Location $NugetDir
|
||||
invoke-expression "NuGet Pack Redis.nuspec"
|
||||
Copy-Item *.nupkg ..\packages\NuGet
|
||||
Set-Location $NugetSrcDir
|
||||
invoke-expression "nuget pack Redis.nuspec"
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Copy-Item *.nupkg $NugetDestDir
|
||||
Write-Host "NuGet package copied to the destination folder." -foregroundcolor black -backgroundcolor green
|
||||
} else {
|
||||
Write-Host "FAILED to create the NuGet package." -foregroundcolor white -backgroundcolor red
|
||||
}
|
||||
|
||||
Write-Host "Run PushPackages to push the packages." -foregroundcolor red -backgroundcolor yellow
|
||||
Set-Location $CurDir
|
||||
|
||||
Write-Host "The .nupkg files are in the 'packages' directory." -foregroundcolor black -backgroundcolor green
|
||||
Write-Host "Run PushPackages to push them." -foregroundcolor red -backgroundcolor yellow
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
param (
|
||||
[string] $Version = $(throw 'Redis version to download is required')
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
|
||||
|
||||
$CurDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$ZipFilename = "redis-x64-" + $Version + ".zip"
|
||||
$CurDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$SourceZip = [System.IO.Path]::Combine($CurDir, $ZipFilename )
|
||||
$DestinationDir = [System.IO.Path]::Combine($CurDir, "signed_binaries" )
|
||||
$GithubUrl = "https://github.com/MSOpenTech/redis/releases/download/win-" + $Version + "/" + $ZipFilename
|
||||
|
||||
$SourceZip = [System.IO.Path]::Combine($CurDir, "..\..\bin\Release\redis-2.8.16.zip" )
|
||||
$Destination = [System.IO.Path]::Combine($CurDir, "signed_binaries" )
|
||||
[System.IO.File]::Delete($SourceZip)
|
||||
[System.IO.Directory]::CreateDirectory($DestinationDir) | Out-Null
|
||||
|
||||
[System.IO.Directory]::CreateDirectory($Destination) | Out-Null
|
||||
|
||||
ForEach( $file in [System.IO.Directory]::EnumerateFiles($Destination) ) {
|
||||
ForEach( $file in [System.IO.Directory]::EnumerateFiles($DestinationDir) ) {
|
||||
[System.IO.File]::Delete($file)
|
||||
}
|
||||
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($SourceZip,$Destination)
|
||||
Write-Host "Downloading zip file from $GithubUrl"
|
||||
(New-Object Net.WebClient).DownloadFile($GithubUrl, $SourceZip);
|
||||
Write-Host "Download complete." -foregroundcolor black -backgroundcolor green
|
||||
|
||||
Write-Host "Binaries copied from $SourceZip to $Destination" -foregroundcolor black -backgroundcolor green
|
||||
Write-Host "Sign these and then run CreatePackages.ps1" -foregroundcolor red -backgroundcolor yellow
|
||||
Write-Host "Extracting files to $DestinationDir"
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($SourceZip,$DestinationDir)
|
||||
Write-Host "Extraction complete." -foregroundcolor black -backgroundcolor green
|
||||
|
||||
# Clean up
|
||||
[System.IO.File]::Delete($SourceZip)
|
||||
|
||||
Write-Host "Sign the binaries and then run CreatePackages.ps1" -foregroundcolor red -backgroundcolor yellow
|
||||
|
||||
@@ -2,6 +2,8 @@ param (
|
||||
[string] $Version = $(throw 'Redis version to push is required')
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "Ensure that the api keys have been set for chocolatey and nuget" -foregroundcolor red -backgroundcolor yellow
|
||||
Write-Host " NuGet SetApiKey <your key here> -source http://chocolatey.org/" -foregroundcolor red -backgroundcolor yellow
|
||||
Write-Host " NuGet SetApiKey <your key here>" -foregroundcolor red -backgroundcolor yellow
|
||||
@@ -9,17 +11,26 @@ Write-Host " NuGet SetApiKey <your key here>" -foregroundcolor red -backgroundc
|
||||
$CurDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
|
||||
$PackagesDir = $CurDir + "\packages"
|
||||
$ChocolateyDir = $PackagesDir + "\Chocolatey"
|
||||
$NugetDir = $PackagesDir + "\Nuget"
|
||||
$ChocolateyDir = $PackagesDir + "\chocolatey"
|
||||
$NugetDir = $PackagesDir + "\nuget"
|
||||
|
||||
Set-Location $ChocolateyDir
|
||||
$ChocolateyCommand = "chocolatey push Redis-64." + $Version + ".nupkg"
|
||||
invoke-expression $ChocolateyCommand
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Chocolatey package pushed successfully." -foregroundcolor black -backgroundcolor green
|
||||
} else {
|
||||
Write-Host "FAILED to push the Chocolatey package." -foregroundcolor white -backgroundcolor red
|
||||
}
|
||||
|
||||
Set-Location $NugetDir
|
||||
$NugetCommand = "NuGet push Redis-64." + $Version + ".nupkg"
|
||||
invoke-expression $NugetCommand
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "NuGet package pushed successfully" -foregroundcolor black -backgroundcolor green
|
||||
} else {
|
||||
Write-Host "FAILED to push the NuGet package." -foregroundcolor white -backgroundcolor red
|
||||
}
|
||||
|
||||
Set-Location $CurDir
|
||||
|
||||
Write-Host "The .nupkg files have been pushed!" -foregroundcolor black -backgroundcolor green
|
||||
|
||||
@@ -18,6 +18,5 @@
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\signed_binaries\*.*" target=".\" />
|
||||
<file src="..\documentation\*.*" target=".\" />
|
||||
</files>
|
||||
</package>
|
||||
|
||||
@@ -18,6 +18,5 @@
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\signed_binaries\*.*" target=".\" />
|
||||
<file src="..\documentation\*.*" target=".\" />
|
||||
</files>
|
||||
</package>
|
||||
|
||||
Reference in New Issue
Block a user