diff --git a/Vagrantfile b/Vagrantfile index df2304801..e81a93099 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -31,5 +31,4 @@ Vagrant.configure(2) do |config| end config.vm.provision "shell", path: "provisioning/Build.ps1", args: "-originalBuildScriptPath \"C:\\vagrant\\provisioning\\\"" - config.vm.provision "shell", path: "provisioning/Installer.ps1", args: "-provisioningDir \"C:\\vagrant\\provisioning\\\"" end diff --git a/package.json b/package.json index 294a2fa8c..67c7a1b08 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,11 @@ "start": "npm run build && electron main.js", "dev": "npm run build && electron main.js ./configs app.dev", "build": "grunt compileMessages", + "buildDevInstaller": "npm run installer:build", + "buildReleaseInstaller": "npm run installer:setVersion && npm run installer:build && npm run installer:rename", + "installer:build": "powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./provisioning/Installer.ps1 -provisioningDir './provisioning'", + "installer:setVersion": "git config core.fileMode false && powershell -NoProfile -ExecutionPolicy Unrestricted -Command fluid-publish --test cleanCmd='echo NOOP'", + "installer:rename": "powershell ./provisioning/RenameInstaller.ps1 -provisioningDir './provisioning' -version '%npm_package_version%'", "pretest": "npm run pretest:clean && npm run build && npm run pretest:instrument", "pretest:clean": "node node_modules/rimraf/bin.js coverage instrumented reports build && node ./node_modules/mkdirp/bin/cmd.js coverage instrumented reports", "pretest:instrument": "node tests/lib/instrumentSource.js", diff --git a/provisioning/Installer.ps1 b/provisioning/Installer.ps1 index 66e8db1f8..13bc3eabf 100644 --- a/provisioning/Installer.ps1 +++ b/provisioning/Installer.ps1 @@ -57,6 +57,9 @@ $appDir = Join-Path $stagingWindowsDir "app" # Install electron-packager globally. # TODO: Define electron-packager invocation in npm scripts. Invoke-Command $npm "install electron-packager -g" $projectDir +# Useful when we are going to bump the version - maybe should go into Npm.ps1 +Invoke-Command $npm "install fluid-publish -g" $projectDir + # Npm install the application, this needs to be done for packaging. Invoke-Command $npm "install" $projectDir diff --git a/provisioning/RenameInstaller.ps1 b/provisioning/RenameInstaller.ps1 new file mode 100644 index 000000000..d51de9efa --- /dev/null +++ b/provisioning/RenameInstaller.ps1 @@ -0,0 +1,20 @@ +<# + This script renames the Windows installer according to the version received when called. +#> + +param ( + [string]$provisioningDir = (Split-Path -parent $PSCommandPath), # Default to script path. + [string]$version +) + +# Turn verbose on, change to "SilentlyContinue" for default behaviour. +$VerbosePreference = "continue" + +# Store the project folder of the script (root of the repo) as $projectDir. +$projectDir = (Get-Item $provisioningDir).parent.FullName + +$currentName = (Get-ChildItem -Path .\installer\ *.msi).FullName +$newName = Join-Path (Join-Path $projectDir "installer") ("GPII." + $version + ".msi") + +Write-Output "Renaming the installer $currentName as $newName" +Rename-Item $currentName $newName