diff --git a/appveyor.yml b/appveyor.yml index b765041d0b..3fb469b0eb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,9 @@ version: 0.0.5.{build} os: Visual Studio 2015 +cache: +- C:\ProgramData\chocolatey\bin -> scripts\ps\appveyor_install.ps1 +- C:\ProgramData\chocolatey\lib -> scripts\ps\appveyor_install.ps1 +- secure-file -> scripts\ps\appveyor_install.ps1 environment: ENCKEY: secure: saYAIpqXzpq0U+JH+MNi/isRQ6Y51PZhm4BrnePDiAPptFO5htxFOLegrYqxdy67 @@ -8,21 +12,13 @@ environment: OPENRCT2.ORG_TOKEN: secure: leQX3xCQpmBLGuMqrxjFlzexDt96ypNRMM5TTRVHbGE8PwVg9crgeykLc2BIZU6HDHveJCHqh2cGMdHtHYJYcw== install: -- cmd: >- - IF DEFINED ENCKEY ( nuget install secure-file -ExcludeVersion && secure-file\tools\secure-file -decrypt distribution\windows\code-sign-key-openrct2.org.pfx.enc -secret %ENCKEY% ) - - cinst nsis.portable --version=3.01-beta1 > nul - ps: >- - curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip - - 7z x nsisxtra.zip > $null - - cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" + .\scripts\ps\appveyor_install.ps1 build_script: - ps: >- .\setenv.ps1 - appveyor_run + appveyor_build artifacts: - path: .\artifacts\openrct2.zip name: OpenRCT2-portable diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 768f104e7b..3c91d2b454 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -41,7 +41,7 @@ Name "${APPNAMEANDVERSION} ${APPBITS}-bit for Windows ${EXTRA_VERSION}" ; NOTE: Keep trailing backslash! InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Install Folder" !ifndef OUTFILE - !define OUTFILE "openrct2-${APPVERSION}-${APPARCH}.exe" + !define OUTFILE "openrct2-install.exe" !endif OutFile "${OUTFILE}" CRCCheck force diff --git a/scripts/ps/appveyor_run.ps1 b/scripts/ps/appveyor_build.ps1 similarity index 100% rename from scripts/ps/appveyor_run.ps1 rename to scripts/ps/appveyor_build.ps1 diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 new file mode 100644 index 0000000000..92a1dcd9ef --- /dev/null +++ b/scripts/ps/appveyor_install.ps1 @@ -0,0 +1,45 @@ +######################################################### +# Script to setup OpenRCT2 for building on AppVeyor +######################################################### + +function Check-ExitCode +{ + if ($LASTEXITCODE -ne 0) + { + $host.SetShouldExit($LASTEXITCODE) + } +} + +if ($env:ENCKEY) +{ + if (-not (Test-Path "secure-file")) + { + Write-Host "Downloading secure-file from NuGet..." -ForegroundColor Cyan + nuget install secure-file -ExcludeVersion + } + + Write-Host "Decrypting code signing key..." -ForegroundColor Cyan + secure-file\tools\secure-file -decrypt distribution\windows\code-sign-key-openrct2.org.pfx.enc -secret $env:ENCKEY + Check-ExitCode +} + +if (${env:OPENRCT2.ORG_TOKEN}) +{ + if (-not (Test-Path "C:\ProgramData\chocolatey\lib\nsis.portable")) + { + Write-Host "Downloading NSIS from chocolatey..." -ForegroundColor Cyan + cinst nsis.portable --version=3.01-beta1 > $null + if ($LASTEXITCODE -ne 0) + { + Get-Content "C:\ProgramData\chocolatey\logs\chocolatey.log" + $host.SetShouldExit(1) + } + + Write-Host "Downloading KillProcDLL for NSIS..." -ForegroundColor Cyan + curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip + Check-ExitCode + 7z x nsisxtra.zip > $null + Check-ExitCode + cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" + } +} diff --git a/scripts/ps/publish.ps1 b/scripts/ps/publish.ps1 index ed2d4288da..9c42f240e8 100644 --- a/scripts/ps/publish.ps1 +++ b/scripts/ps/publish.ps1 @@ -18,17 +18,17 @@ param ( [switch]$Symbols = $false ) -if ($GitTag -eq "") +if (-not $GitTag) { - if ($GitBranch -eq $null) + if (-not $GitBranch) { $GitBranch = (git rev-parse --abbrev-ref HEAD) } - if ($GitCommitSha1 -eq $null) + if (-not $GitCommitSha1) { $GitCommitSha1 = (git rev-parse HEAD) } - if ($GitCommitSha1Short -eq $null) + if (-not $GitCommitSha1Short) { $GitCommitSha1Short = (git rev-parse --short HEAD) }