diff --git a/Deploy/binary_zip.ps1 b/Deploy/binary_zip.ps1 deleted file mode 100644 index 712eebb3eb..0000000000 --- a/Deploy/binary_zip.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -$sourceDirectoryName = $env:APPVEYOR_BUILD_FOLDER + "\Output\Release" -$fileName = $env:APPVEYOR_BUILD_FOLDER + "\Wox-$env:APPVEYOR_BUILD_VERSION.zip" - -$currentPath = Convert-Path . -Write-Host "Current path: " + $currentPath -Write-Host "Target path: " + $sourceDirectoryName - -[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") -[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDirectoryName, $fileName) \ No newline at end of file diff --git a/Deploy/local_build.ps1 b/Deploy/local_build.ps1 deleted file mode 100644 index 9dd7582b19..0000000000 --- a/Deploy/local_build.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -New-Alias nuget.exe ".\packages\NuGet.CommandLine.*\tools\NuGet.exe" -$env:APPVEYOR_BUILD_FOLDER = Convert-Path . -$env:APPVEYOR_BUILD_VERSION = "1.2.0" -& .\Deploy\squirrel_installer.ps1 \ No newline at end of file diff --git a/Deploy/nuget.ps1 b/Deploy/nuget.ps1 deleted file mode 100644 index 363566475b..0000000000 --- a/Deploy/nuget.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -$path = $env:APPVEYOR_BUILD_FOLDER + "\Deploy\wox.plugin.nuspec" - -$currentPath = Convert-Path . -Write-Host "Current path:" + $currentPath -Write-Host "nuspec path:" + $path - -& nuget pack $path -Version $env:APPVEYOR_BUILD_VERSION diff --git a/Deploy/squirrel_installer.ps1 b/Deploy/squirrel_installer.ps1 deleted file mode 100644 index cec94831e5..0000000000 --- a/Deploy/squirrel_installer.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -# msbuild based installer generation is not working in appveyor, not sure why - -$currentPath = Convert-Path . -Write-Host "Current path: " + $currentPath - -$path = $env:APPVEYOR_BUILD_FOLDER + "\Deploy\wox.nuspec" -Write-Host "nuspec path: " + $path -$releasePath = $env:APPVEYOR_BUILD_FOLDER + "\Output\Release" -& nuget.exe pack $path -Version $env:APPVEYOR_BUILD_VERSION -Properties Configuration=Release -BasePath $releasePath - -$nupkgPath = $env:APPVEYOR_BUILD_FOLDER + "\Wox." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" -Write-Host "nupkg path: " + $nupkgPath - -# must use Squirrel.com, Squirrel.exe will produce nothing -$squirrelPath = $env:APPVEYOR_BUILD_FOLDER + "\packages\squirrel*\tools\Squirrel.com" -Write-Host "squirrel path: " + $squirrelPath -$iconPath = $env:APPVEYOR_BUILD_FOLDER + "\Wox\Resources\app.ico" -& $squirrelPath --releasify $nupkgPath --setupIcon $iconPath --no-msi - -$path = "Releases\" + "Wox-" + $env:APPVEYOR_BUILD_VERSION + ".exe" -mv Releases\Setup.exe $path diff --git a/RELEASES b/RELEASES new file mode 100644 index 0000000000..82dd3ebc7e --- /dev/null +++ b/RELEASES @@ -0,0 +1 @@ +044D97C5B007836BE9856C7D2E063967EE620496 Wox-1.2.0-full.nupkg 5899261 \ No newline at end of file diff --git a/Scripts/build.ps1 b/Scripts/build.ps1 new file mode 100644 index 0000000000..d007483dfe --- /dev/null +++ b/Scripts/build.ps1 @@ -0,0 +1,106 @@ +function Build-Version { + if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_VERSION)) { + $v = "1.2.0" + } else { + $v = $env:APPVEYOR_BUILD_VERSION + } + + Write-Host "Build Version: $v" + return $v +} + +function Build-Path { + if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_FOLDER)) { + $p = Convert-Path . + } else { + $p = $env:APPVEYOR_BUILD_FOLDER + } + + Write-Host "Build Folder: $p" + Set-Location $p + + return $p +} + +function Validate-Directory ($output) { + New-Item $output -ItemType Directory -Force +} + +function Pack-Nuget ($path, $version, $output) { + Write-Host "Begin build nuget library" + + $spec = "$path\Scripts\wox.plugin.nuspec" + Write-Host "nuspec path: $spec" + Write-Host "Output path: $output" + + Nuget pack $spec -Version $version -OutputDirectory $output + + Write-Host "End build nuget library" +} + +function Zip-Release ($path, $version, $output) { + Write-Host "Begin zip release" + + $input = "$path\Output\Release" + Write-Host "Input path: $input" + $file = "$output\Wox-$version.zip" + Write-Host "Filename: $file" + + [Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") + [System.IO.Compression.ZipFile]::CreateFromDirectory($input, $file) + + Write-Host "End zip release" +} + +function Pack-Squirrel-Installer ($path, $version, $output) { + # msbuild based installer generation is not working in appveyor, not sure why + Write-Host "Begin pack squirrel installer" + + $spec = "$path\Scripts\wox.nuspec" + Write-Host "nuspec path: $spec" + $input = "$path\Output\Release" + Write-Host "Input path: $input" + Nuget pack $spec -Version $version -Properties Configuration=Release -BasePath $input -OutputDirectory $output + + $nupkg = "$output\Wox.$version.nupkg" + Write-Host "nupkg path: $nupkg" + $icon = "$path\Wox\Resources\app.ico" + # Squirrel.com: https://github.com/Squirrel/Squirrel.Windows/issues/369 + New-Alias Squirrel $path\packages\squirrel*\tools\Squirrel.exe -Force + # why we need Write-Output: https://github.com/Squirrel/Squirrel.Windows/issues/489#issuecomment-156039327 + # directory of releaseDir in fucking squirrel can't be same as directory ($nupkg) in releasify + $temp = "$output\Temp" + + Squirrel --releasify $nupkg --releaseDir $temp --setupIcon $iconPath --no-msi | Write-Output + Move-Item $temp\* $output -Force + Remove-Item $temp + + $file = "$output\Wox-$version.exe" + Write-Host "Filename: $file" + + Move-Item "$output\Setup.exe" $file -Force + + Write-Host "End pack squirrel installer" +} + +function Main { + $v = Build-Version + $p = Build-Path + $o = "$p\Output\Packages" + New-Alias Nuget $p\packages\NuGet.CommandLine.*\tools\NuGet.exe -Force + + Validate-Directory $o + + $isInCI = $env:APPVEYOR + if ($isInCI) { + Pack-Nuget $p $v $o + Zip-Release $p $v $o + } + + Pack-Squirrel-Installer $p $v $o + + Write-Host "List output directory" + Get-ChildItem $o +} + +Main \ No newline at end of file diff --git a/Deploy/wox.nuspec b/Scripts/wox.nuspec similarity index 100% rename from Deploy/wox.nuspec rename to Scripts/wox.nuspec diff --git a/Deploy/wox.plugin.nuspec b/Scripts/wox.plugin.nuspec similarity index 100% rename from Deploy/wox.plugin.nuspec rename to Scripts/wox.plugin.nuspec diff --git a/Wox.sln b/Wox.sln index 4c229fa733..fd28834d1b 100644 --- a/Wox.sln +++ b/Wox.sln @@ -57,10 +57,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitattributes = .gitattributes .gitignore = .gitignore appveyor.yml = appveyor.yml + Scripts\binary_zip.ps1 = Scripts\binary_zip.ps1 LICENSE = LICENSE + Scripts\nuget.ps1 = Scripts\nuget.ps1 Performance1.psess = Performance1.psess README.md = README.md + Scripts\setup.ps1 = Scripts\setup.ps1 SolutionAssemblyInfo.cs = SolutionAssemblyInfo.cs + Scripts\squirrel_installer.ps1 = Scripts\squirrel_installer.ps1 + Scripts\wox.nuspec = Scripts\wox.nuspec + Scripts\wox.plugin.nuspec = Scripts\wox.plugin.nuspec EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldCSharp", "Plugins\HelloWorldCSharp\HelloWorldCSharp.csproj", "{03FFA443-5F50-48D5-8869-F3DF316803AA}" diff --git a/appveyor.yml b/appveyor.yml index 5fbe2609ff..ebdf05d85a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,21 +14,17 @@ build: project: Wox.sln after_test: - ps: >- - .\Deploy\nuget.ps1 - - .\Deploy\binary_zip.ps1 - - .\Deploy\squirrel_installer.ps1 + .\Scripts\build.ps1 artifacts: -- path: 'Wox-*.zip' +- path: 'Output\Packages\Wox-*.zip' name: zipped_binary -- path: '*.nupkg' +- path: 'Output\Packages\Wox.Plugin.*.nupkg' name: nuget_package -- path: '\Releases\*.exe' +- path: 'Output\Packages\*.exe' name: installer -- path: '\Releases\*.nupkg' +- path: 'Output\Packages\Wox.*-full.nupkg' name: installer -- path: 'Releases\RELEASES' +- path: 'Output\Packages\RELEASES' name: installer deploy: provider: NuGet