From 4cc5791d2d4f330d03408561ed421a7b3625e251 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:21:47 +0100 Subject: [PATCH 01/16] Update artifact names --- app/builder-config-win.yaml | 1 + app/builder-config.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/builder-config-win.yaml b/app/builder-config-win.yaml index f2d30365..2ed3008e 100644 --- a/app/builder-config-win.yaml +++ b/app/builder-config-win.yaml @@ -2,6 +2,7 @@ directories: output: release-builds buildResources: app/resources appId: org.openflexure.ev +artifactName: ${name}-${os}-${arch}.${ext} asar: true files: - filter: diff --git a/app/builder-config.yaml b/app/builder-config.yaml index 7b910319..abe74a1c 100644 --- a/app/builder-config.yaml +++ b/app/builder-config.yaml @@ -2,6 +2,7 @@ directories: output: release-builds buildResources: app/resources appId: org.openflexure.ev +artifactName: ${name}-${os}-${arch}.${ext} asar: true files: - filter: From 5075f52672fe3f0ebff492ab1db90f93db0a31b1 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:22:03 +0100 Subject: [PATCH 02/16] 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 From 76c59dd5105b2171b0524b9f63f6bbcdb256a6b6 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:23:08 +0100 Subject: [PATCH 03/16] Include nupkg in artifacts --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b941c22..cbaa5182 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,4 +8,5 @@ build: paths: - release-builds/*.exe - release-builds/*.deb - - release-builds/*.AppImage \ No newline at end of file + - release-builds/*.AppImage + - release-builds/*.nupkg \ No newline at end of file From 4b9b955e3f13fce5b7089b3db2cafd298ff3b8e5 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:28:51 +0100 Subject: [PATCH 04/16] First draft of deploy CI stage --- .gitlab-ci.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbaa5182..593ad96c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,10 @@ -image: electronuserland/builder:wine +stages: + - build + - deploy build: + stage: build + image: electronuserland/builder:wine script: - npm install - npm run release @@ -9,4 +13,13 @@ build: - release-builds/*.exe - release-builds/*.deb - release-builds/*.AppImage + +deploy: + stage: deploy + tags: + - windows + script: + - .\app\make-nupkg.ps1 + artifacts: + paths: - release-builds/*.nupkg \ No newline at end of file From 2e5c31299806b3e2a46a6aab5097547dafdafde1 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:54:52 +0100 Subject: [PATCH 05/16] Added debug line --- app/make-nupkg.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/app/make-nupkg.ps1 b/app/make-nupkg.ps1 index ddecc77f..77053b7d 100644 --- a/app/make-nupkg.ps1 +++ b/app/make-nupkg.ps1 @@ -21,6 +21,7 @@ $MinVer = $MinVer.Replace(".", "") # Convert symver into nuspec ver $version = $MajVer + "-" + $MinVer $InstURL = "$Env:CI_JOB_URL/artifacts/browse/release-builds/openflexure-ev-win.exe" +echo $InstURL $NuSpec = @" From 6ac0c58fc20512b22e526d0d580a02f51d8450e1 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Mon, 6 May 2019 11:54:59 +0100 Subject: [PATCH 06/16] Moved to choco linux --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 593ad96c..e47b0a36 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,10 +16,9 @@ build: deploy: stage: deploy - tags: - - windows + image: patrickhuber/choco-linux script: - - .\app\make-nupkg.ps1 + - powershell .\app\make-nupkg.ps1 artifacts: paths: - release-builds/*.nupkg \ No newline at end of file From 9a5868e817437a2aacc36f37ea86e24896ef9746 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 14:29:25 +0100 Subject: [PATCH 07/16] Moved CI to choco on linux image --- .gitlab-ci.yml | 4 ++- app/make-nupkg.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 app/make-nupkg.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e47b0a36..9c52a87f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,9 @@ deploy: stage: deploy image: patrickhuber/choco-linux script: - - powershell .\app\make-nupkg.ps1 + - chmod +x ./app/make-nupkg.sh + - ./app/make-nupkg.sh artifacts: paths: + - release-builds/*.nuspec - release-builds/*.nupkg \ No newline at end of file diff --git a/app/make-nupkg.sh b/app/make-nupkg.sh new file mode 100644 index 00000000..e8b17619 --- /dev/null +++ b/app/make-nupkg.sh @@ -0,0 +1,70 @@ +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/browse/release-builds/openflexure-ev-win.exe" + +# 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 --outputdirectory $outpath "$outpath/openflexure-ev.nuspec" \ No newline at end of file From 5071bb62a4ad39a625f77b8723d3655ee7a0e836 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 14:52:16 +0100 Subject: [PATCH 08/16] Enabled unofficial choco builds --- app/make-nupkg.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/make-nupkg.sh b/app/make-nupkg.sh index e8b17619..6cc60350 100644 --- a/app/make-nupkg.sh +++ b/app/make-nupkg.sh @@ -31,6 +31,7 @@ echo $version # Build installer URL instURL="$CI_JOB_URL/artifacts/browse/release-builds/openflexure-ev-win.exe" +echo $instURL # Build nuspec cat > "$outpath/openflexure-ev.nuspec" <<- EOL @@ -67,4 +68,4 @@ instPS1="Install-ChocolateyPackage $packageName $fileType $silentArgs $instURL" echo $instPS1 > "$toolspath/chocolateyInstall.ps1" # Build nupkg -choco pack --outputdirectory $outpath "$outpath/openflexure-ev.nuspec" \ No newline at end of file +choco pack --allow-unofficial --outputdirectory $outpath "$outpath/openflexure-ev.nuspec" \ No newline at end of file From dbcac749a332066e6e71b83bda1bf9a380f48115 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 15:03:33 +0100 Subject: [PATCH 09/16] Moved nuspec to build stage, pack to deploy stage --- .gitlab-ci.yml | 9 ++++++--- app/make-nupkg.sh | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9c52a87f..2f9c9cf6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,19 +8,22 @@ build: script: - npm install - npm run release + - chmod +x ./app/make-nupkg.sh + - ./app/make-nupkg.sh + artifacts: paths: - release-builds/*.exe - release-builds/*.deb - release-builds/*.AppImage + - release-builds/*.nuspec + - release-builds/*.ps1 deploy: stage: deploy image: patrickhuber/choco-linux script: - - chmod +x ./app/make-nupkg.sh - - ./app/make-nupkg.sh + - choco pack --allow-unofficial --outputdirectory "./release-builds/choco" "./release-builds/choco/openflexure-ev.nuspec" artifacts: paths: - - release-builds/*.nuspec - release-builds/*.nupkg \ No newline at end of file diff --git a/app/make-nupkg.sh b/app/make-nupkg.sh index 6cc60350..1c979e6b 100644 --- a/app/make-nupkg.sh +++ b/app/make-nupkg.sh @@ -68,4 +68,4 @@ instPS1="Install-ChocolateyPackage $packageName $fileType $silentArgs $instURL" echo $instPS1 > "$toolspath/chocolateyInstall.ps1" # Build nupkg -choco pack --allow-unofficial --outputdirectory $outpath "$outpath/openflexure-ev.nuspec" \ No newline at end of file +# choco pack --allow-unofficial --outputdirectory $outpath "$outpath/openflexure-ev.nuspec" \ No newline at end of file From 0d28c287a528014c542d125ef2d75ea0ea8932d6 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 15:10:31 +0100 Subject: [PATCH 10/16] Fixed artifact paths in build stage --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f9c9cf6..c47dc967 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,8 +16,8 @@ build: - release-builds/*.exe - release-builds/*.deb - release-builds/*.AppImage - - release-builds/*.nuspec - - release-builds/*.ps1 + - release-builds/choco/openflexure-ev.nuspec + - release-builds/choco/tools/chocolateyInstall.ps1 deploy: stage: deploy @@ -26,4 +26,4 @@ deploy: - choco pack --allow-unofficial --outputdirectory "./release-builds/choco" "./release-builds/choco/openflexure-ev.nuspec" artifacts: paths: - - release-builds/*.nupkg \ No newline at end of file + - release-builds/choco/*.nupkg \ No newline at end of file From 733400737f00eec89c58de98d0121bc3b447d6ea Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 15:29:02 +0100 Subject: [PATCH 11/16] Debugging deploy --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c47dc967..d4d71c33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,10 @@ build: deploy: stage: deploy image: patrickhuber/choco-linux + dependencies: + - build script: + - ls -R ./release-builds/ - choco pack --allow-unofficial --outputdirectory "./release-builds/choco" "./release-builds/choco/openflexure-ev.nuspec" artifacts: paths: From 47d11001a49a9055e52691eb6703eb31a4aa789e Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 15:32:37 +0100 Subject: [PATCH 12/16] Fixed artifact URL --- app/make-nupkg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/make-nupkg.sh b/app/make-nupkg.sh index 1c979e6b..73daff76 100644 --- a/app/make-nupkg.sh +++ b/app/make-nupkg.sh @@ -30,7 +30,7 @@ version="$majVer-$minVer" echo $version # Build installer URL -instURL="$CI_JOB_URL/artifacts/browse/release-builds/openflexure-ev-win.exe" +instURL="$CI_JOB_URL/artifacts/raw/release-builds/openflexure-ev-win.exe" echo $instURL # Build nuspec From 6a1b3e26bc475b3335c902549f14f43b8aa0c4d9 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 15:51:00 +0100 Subject: [PATCH 13/16] Fixed tools path for linux builds --- app/make-nupkg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/make-nupkg.sh b/app/make-nupkg.sh index 73daff76..fda63832 100644 --- a/app/make-nupkg.sh +++ b/app/make-nupkg.sh @@ -58,7 +58,7 @@ cat > "$outpath/openflexure-ev.nuspec" <<- EOL https://gitlab.com/openflexure/openflexure-microscope-jsclient/raw/master/app/icons/png/512x512.png - + EOL From d5ba3988804bdebbd06b59aedcfbc12d0e8d8fd0 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 16:11:10 +0100 Subject: [PATCH 14/16] Try to fix choco pack tools path error --- .gitlab-ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4d71c33..0f9f1c63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,6 @@ build: - npm run release - chmod +x ./app/make-nupkg.sh - ./app/make-nupkg.sh - artifacts: paths: - release-builds/*.exe @@ -18,6 +17,8 @@ build: - release-builds/*.AppImage - release-builds/choco/openflexure-ev.nuspec - release-builds/choco/tools/chocolateyInstall.ps1 + only: + - tags deploy: stage: deploy @@ -26,7 +27,10 @@ deploy: - build script: - ls -R ./release-builds/ - - choco pack --allow-unofficial --outputdirectory "./release-builds/choco" "./release-builds/choco/openflexure-ev.nuspec" + - cd ./release-builds/choco + - choco pack artifacts: paths: - - release-builds/choco/*.nupkg \ No newline at end of file + - release-builds/choco/*.nupkg + only: + - tags From 002e154abeac3745fd24c6443305b06ca460d6c0 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 16:12:15 +0100 Subject: [PATCH 15/16] Rearranged deply pack debug --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f9f1c63..104eab7a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,8 +26,8 @@ deploy: dependencies: - build script: - - ls -R ./release-builds/ - cd ./release-builds/choco + - ls -R - choco pack artifacts: paths: From 57ee303f425ef1b0b0b756837a41a634a8eabb00 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 6 May 2019 16:13:45 +0100 Subject: [PATCH 16/16] Remove tag restriction for debugging --- .gitlab-ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 104eab7a..424aea2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,8 +17,6 @@ build: - release-builds/*.AppImage - release-builds/choco/openflexure-ev.nuspec - release-builds/choco/tools/chocolateyInstall.ps1 - only: - - tags deploy: stage: deploy @@ -32,5 +30,3 @@ deploy: artifacts: paths: - release-builds/choco/*.nupkg - only: - - tags