Fixed nupkg generator from mod feedback

This commit is contained in:
Joel Collins 2019-05-17 16:05:02 +01:00
parent 7fea0cbd79
commit b9fbfed530

View file

@ -1,27 +1,30 @@
silentArgs='/S' #!/bin/bash
packageName='openflexure-ev'
fileType='exe'
scriptPath=`dirname $0` packageName='openflexure-ev'
scriptPath=$(dirname "$0")
packagePath="$(dirname "$scriptPath")" packagePath="$(dirname "$scriptPath")"
packageJson="$packagePath/package.json" packageJson="$packagePath/package.json"
installerPath="$packagePath/openflexure-ev-win.exe"
installerMd5=`md5sum ${installerPath} | awk '{ print $1 }'`
echo "$installerMd5"
outpath="$packagePath/release-builds/choco" outpath="$packagePath/release-builds/choco"
toolspath="$outpath/tools" toolspath="$outpath/tools"
mkdir -p $toolspath mkdir -p "$toolspath"
echo $scriptPath echo "$scriptPath"
echo $packageJson echo "$packageJson"
echo $outpath echo "$outpath"
# Get package version from package.json # Get package version from package.json
packageVersion=$(cat $packageJson \ packageVersion=$(grep version < "$packageJson" | head -1 \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \ | awk -F: '{ print $2 }' \
| sed 's/[",]//g' \ | sed 's/[",]//g' \
| tr -d '[[:space:]]') | tr -d ':space:')
echo "$packageVersion" echo "Package version: $packageVersion"
# Convert into a nupkg-safe version string # Convert into a nupkg-safe version string
majVer="$(echo "$packageVersion" | cut -d'-' -f1)" majVer="$(echo "$packageVersion" | cut -d'-' -f1)"
@ -34,12 +37,14 @@ else
version="$majVer-$minVer" version="$majVer-$minVer"
fi fi
echo "Nupkg version: $version"
echo "$version"
# Build installer URL # Build installer URL
instURL="$CI_JOB_URL/artifacts/raw/release-builds/openflexure-ev-win.exe" pipelineURL="$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_REF_NAME/raw"
echo $instURL instURL="$pipelineURL/openflexure-ev-win.exe?job=package:win32"
nuspecURL="$CI_JOB_URL/artifacts/browse"
echo "$instURL"
# Build nuspec # Build nuspec
cat > "$outpath/openflexure-ev.nuspec" <<- EOL cat > "$outpath/openflexure-ev.nuspec" <<- EOL
@ -50,15 +55,16 @@ cat > "$outpath/openflexure-ev.nuspec" <<- EOL
<title>OpenFlexure eV</title> <title>OpenFlexure eV</title>
<version>$version</version> <version>$version</version>
<authors>OpenFlexure</authors> <authors>OpenFlexure</authors>
<owners>Bath Open Instrumentation Group</owners> <owners>Joel Collins</owners>
<summary>OpenFlexure Microscope client</summary> <summary>OpenFlexure Microscope client</summary>
<description>An electron-based user client for the OpenFlexure Microscope Server</description> <description>An electron-based user client for the OpenFlexure Microscope Server</description>
<projectUrl>https://www.openflexure.org/</projectUrl> <projectUrl>https://www.openflexure.org/</projectUrl>
<docsUrl>https://www.openflexure.org/projects/microscope/</docsUrl> <docsUrl>https://www.openflexure.org/projects/microscope/</docsUrl>
<bugTrackerUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/issues</bugTrackerUrl> <bugTrackerUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/issues</bugTrackerUrl>
<projectSourceUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/</projectSourceUrl> <projectSourceUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/</projectSourceUrl>
<packageSourceUrl>$nuspecURL</packageSourceUrl>
<packageSourceUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/</packageSourceUrl>
<tags>openflexure microscope ev</tags> <tags>openflexure microscope ev</tags>
<licenseUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/raw/master/LICENSE</licenseUrl> <licenseUrl>https://gitlab.com/openflexure/openflexure-microscope-jsclient/raw/master/LICENSE</licenseUrl>
@ -72,8 +78,26 @@ cat > "$outpath/openflexure-ev.nuspec" <<- EOL
EOL EOL
# Build installer PS1 content # Build installer PS1 content
instPS1="Install-ChocolateyPackage $packageName $fileType $silentArgs $instURL" cat > "$toolspath/chocolateyInstall.ps1" <<- EOL
echo $instPS1 > "$toolspath/chocolateyInstall.ps1" \$ErrorActionPreference = "Stop";
\$toolsDir = "\$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
\$url = "$instURL"
# Build nupkg \$packageArgs = @{
# choco pack --allow-unofficial --outputdirectory $outpath "$outpath/openflexure-ev.nuspec" packageName = "openflexure-ev"
unzipLocation = \$toolsDir
fileType = "exe"
url = \$url
url64bit = \$url
softwareName = "OpenFlexure eV"
checksum = "${installerMd5}"
checksumType = "md5"
silentArgs = "/S"
}
Install-ChocolateyPackage @packageArgs
EOL