From 5075f52672fe3f0ebff492ab1db90f93db0a31b1 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:22:03 +0100 Subject: [PATCH] Add script to generate nupkg files for choco --- app/make-nupkg.ps1 | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 app/make-nupkg.ps1 diff --git a/app/make-nupkg.ps1 b/app/make-nupkg.ps1 new file mode 100644 index 00000000..ddecc77f --- /dev/null +++ b/app/make-nupkg.ps1 @@ -0,0 +1,65 @@ +$silentArgs = '/S' +$packageName = 'openflexure-ev' +$fileType = 'exe' + +$packagepath = Join-Path -Path $PSScriptRoot -ChildPath '..\' +$packageJson = Join-Path -Path $packagepath -ChildPath '\package.json' +$outpath = Join-Path -Path $packagepath -ChildPath 'release-builds\choco' + +echo $packagepath +echo $outpath + +If(!(test-path $outpath)) +{ + New-Item -ItemType Directory -Force -Path $outpath +} + +# Get version from package.json +$FullVersion = (Get-Content $packageJson) -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version" +$MajVer, $MinVer = $FullVersion.Split("-") # Split version number from beta string +$MinVer = $MinVer.Replace(".", "") # Convert symver into nuspec ver +$version = $MajVer + "-" + $MinVer + +$InstURL = "$Env:CI_JOB_URL/artifacts/browse/release-builds/openflexure-ev-win.exe" + +$NuSpec = @" + + + + $packageName + OpenFlexure eV + $Version + OpenFlexure + Bath Open Instrumentation Group + OpenFlexure Microscope client + An electron-based user client for the OpenFlexure Microscope Server + https://www.openflexure.org/ + https://www.openflexure.org/projects/microscope/ + https://gitlab.com/openflexure/openflexure-microscope-jsclient/issues + https://gitlab.com/openflexure/openflexure-microscope-jsclient/ + + https://gitlab.com/openflexure/openflexure-microscope-jsclient/ + + openflexure microscope ev + https://gitlab.com/openflexure/openflexure-microscope-jsclient/raw/master/LICENSE + false + https://gitlab.com/openflexure/openflexure-microscope-jsclient/raw/master/app/icons/png/512x512.png + + + + + +"@ + +echo $NuSpec | Out-File -force -FilePath "$outpath\openflexure-ev.nuspec" + +$InstPS1 = "Install-ChocolateyPackage '$packageName' '$fileType' '$silentArgs' '$InstURL'" + +$toolspath = "$outpath\tools" +If(!(test-path $toolspath)) +{ + New-Item -ItemType Directory -Force -Path $toolspath +} +echo $InstPS1 | Out-File -force -FilePath "$toolspath\chocolateyInstall.ps1" + +choco pack --outputdirectory $outpath "$outpath\openflexure-ev.nuspec" \ No newline at end of file