silentArgs='/S' packageName='openflexure-ev' fileType='exe' scriptPath=`dirname $0` packagePath="$(dirname "$scriptPath")" packageJson="$packagePath/package.json" outpath="$packagePath/release-builds/choco" toolspath="$outpath/tools" mkdir -p $toolspath echo $scriptPath echo $packageJson echo $outpath # Get package version from package.json packageVersion=$(cat $packageJson \ | grep version \ | head -1 \ | awk -F: '{ print $2 }' \ | sed 's/[",]//g' \ | tr -d '[[:space:]]') # Convert into a nupkg-safe version string majVer="$(echo $packageVersion | cut -d'-' -f1)" minVer="$(echo $packageVersion | cut -d'-' -f2)" minVer="${minVer//.}" version="$majVer-$minVer" echo $version # Build installer URL instURL="$CI_JOB_URL/artifacts/raw/release-builds/openflexure-ev-win.exe" echo $instURL # Build nuspec cat > "$outpath/openflexure-ev.nuspec" <<- EOL $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 EOL # Build installer PS1 content instPS1="Install-ChocolateyPackage $packageName $fileType $silentArgs $instURL" echo $instPS1 > "$toolspath/chocolateyInstall.ps1" # Build nupkg # choco pack --allow-unofficial --outputdirectory $outpath "$outpath/openflexure-ev.nuspec"