From b9bd45d83c15c8dd4dc4da8e2c97faefe5fd316b Mon Sep 17 00:00:00 2001 From: Thiago Lugli Date: Thu, 19 Sep 2019 14:51:39 -0300 Subject: [PATCH] Release builds (#5) * Scripts to build releases * Fix windows release script --- .gitignore | 1 + tools/generateReleaseBuildsLinux.sh | 59 ++++++++++++++++++++++++ tools/generateReleaseBuildsWindows.ps1 | 63 ++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100755 tools/generateReleaseBuildsLinux.sh create mode 100644 tools/generateReleaseBuildsWindows.ps1 diff --git a/.gitignore b/.gitignore index 2ebaca6a..661f4609 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/* +releases/* *~ .settings .c9* diff --git a/tools/generateReleaseBuildsLinux.sh b/tools/generateReleaseBuildsLinux.sh new file mode 100755 index 00000000..d9f78dcb --- /dev/null +++ b/tools/generateReleaseBuildsLinux.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +RELEASE_VERSION=$1 +PACKAGE_VERSION=$(node -pe "require('./package.json').version") +SOURCE_PATH="${BASH_SOURCE%/*}/.." + +declare -a node_versions=( + "0.10.48" + "0.12.18" + "4.9.1" + "5.9.1" + "6.17.1" + "8.16.1" + "10.16.0" + "11.15.0" + "12.10.0" +) + +declare -a electron_versions=( + "1.2.8" + "1.3.8" + "1.4.6" + "1.7.12" + "2.0.18" + "3.1.13" + "4.2.10" + "5.0.10" + "6.0.7" +) + +# remove old build directory +rm -rf "$SOURCHE_PATH/build" > /dev/null + +# create release path +mkdir -p "$SOURCE_PATH/releases/$RELEASE_VERSION" > /dev/null + +for version in "${node_versions[@]}" +do + echo "Building for node version: $version..." + node-pre-gyp configure --target=$version --module_name=node_printer --silent + node-pre-gyp build package --target=$version --target_arch=x64 --build-from-source --silent + node-pre-gyp configure --target=$version --module_name=node_printer --silent + node-pre-gyp build package --target=$version --target_arch=ia32 --build-from-source --silent + rsync -a -v "$SOURCE_PATH/build/stage/$PACKAGE_VERSION/" "$SOURCE_PATH/releases/$RELEASE_VERSION/" --remove-source-files > /dev/null + echo "Done" +done + +for version in "${electron_versions[@]}" +do + echo "Building for electron version: $version..." + node-pre-gyp configure --target=$version --dist-url=https://electronjs.org/headers --module_name=node_printer --silent + node-pre-gyp build package --target=$version --target_arch=x64 --runtime=electron --build-from-source --silent + node-pre-gyp configure --target=$version --dist-url=https://electronjs.org/headers --module_name=node_printer --silent + node-pre-gyp build package --target=$version --target_arch=ia32 --runtime=electron --build-from-source --silent + rsync -a -v "$SOURCE_PATH/build/stage/$PACKAGE_VERSION/" "$SOURCE_PATH/releases/$RELEASE_VERSION/" --remove-source-files > /dev/null + echo "Done" +done + +echo "Finished succesfully!" diff --git a/tools/generateReleaseBuildsWindows.ps1 b/tools/generateReleaseBuildsWindows.ps1 new file mode 100644 index 00000000..6a33a03d --- /dev/null +++ b/tools/generateReleaseBuildsWindows.ps1 @@ -0,0 +1,63 @@ +param ( + [Parameter(Mandatory=$true)][string]$release +) + +$SOURCE_PATH = split-path -parent $MyInvocation.MyCommand.Definition +$RELEASE_VERSION = $release +$PACKAGE_VERSION = node -pe "require('./package.json').version" + +echo $SOURCE_PATH + +$node_versions = @( + "0.10.48", + "0.12.18", + "4.9.1", + "5.9.1", + "6.17.1", + "8.16.1", + "10.16.0", + "11.15.0", + "12.10.0" +) + +$electron_versions = @( + "1.2.8", + "1.3.8", + "1.4.6", + "1.7.12", + "2.0.18", + "3.1.13", + "4.2.10", + "5.0.10", + "6.0.7" +) + +# remove old build directory +Remove-Item -Recurse -Force $SOURCE_PATH'\..\build' -ErrorAction Ignore | Out-Null + +# create release path +New-Item $SOURCE_PATH'\..\releases\'$RELEASE_VERSION -ItemType Directory -ea 0 | Out-Null + +foreach ($version in $node_versions) { + Write-Output "Building for node version: $version..." + node-pre-gyp configure --target=$version --module_name=node_printer --silent | Out-Null + node-pre-gyp build package --target=$version --target_arch=x64 --build-from-source --silent | Out-Null + node-pre-gyp configure --target=$version --module_name=node_printer --silent | Out-Null + node-pre-gyp build package --target=$version --target_arch=ia32 --build-from-source --silent | Out-Null + Copy-item -Force -Recurse $SOURCE_PATH'\..\build\stage\'$PACKAGE_VERSION\* -Destination $SOURCE_PATH'\..\releases\'$RELEASE_VERSION -ErrorAction Ignore | Out-Null + Remove-Item -Recurse -Force $SOURCE_PATH'\..\build\stage' | Out-Null + Write-Output "Done" +} + +foreach ($version in $electron_versions) { + Write-Output "Building for electron version: $version..." + node-pre-gyp configure --target=$version --dist-url=https://electronjs.org/headers --module_name=node_printer --silent | Out-Null + node-pre-gyp build package --target=$version --target_arch=x64 --runtime=electron --build-from-source --silent | Out-Null + node-pre-gyp configure --target=$version --dist-url=https://electronjs.org/headers --module_name=node_printer --silent | Out-Null + node-pre-gyp build package --target=$version --target_arch=ia32 --runtime=electron --build-from-source --silent | Out-Null + Copy-item -Force -Recurse $SOURCE_PATH'\..\build\stage\'$PACKAGE_VERSION\* -Destination $SOURCE_PATH'\..\releases\'$RELEASE_VERSION -ErrorAction Ignore | Out-Null + Remove-Item -Recurse -Force $SOURCE_PATH'\..\build\stage' | Out-Null + Write-Output "Done" +} + +Write-Output "Finished succesfully!" \ No newline at end of file