chore: SDA-2793: move all build steps to the build scripts (#1149)

* chore: move full build process to script for macOS

* chore: move full build process to script for win

* update the windows scripts

* SDA-2793: include wix sharp file for new build
This commit is contained in:
Vishwas Shashidhar 2020-12-15 18:14:22 +05:30 committed by GitHub
parent 538f2e92a0
commit c41fe4f905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 148 additions and 119 deletions

View File

@ -1,5 +1,9 @@
#!/bin/bash
# Unlock the keychain
echo "Unlocking keychain"
security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_NAME"
NODE_REQUIRED_VERSION=v12.13.1
SNYK_ORG=sda
SNYK_PROJECT_NAME="Symphony Desktop Application"
@ -116,21 +120,49 @@ npm run unpacked-mac
echo "Creating .pkg"
/usr/local/bin/packagesbuild -v installer/mac/symphony-mac-packager.pkgproj
PACKAGE=installer/mac/build/Symphony.pkg
if [ ! -e ${PACKAGE} ]; then
echo "BUILD PACKAGE FAILED: package not created: ${PACKAGE}"
exit 1
fi
echo "Package created: ${PACKAGE}"
# Sign the app
PKG_VERSION=$(node -e "console.log(require('./package.json').version);")
echo "Signing Package: ${PACKAGE}"
SIGNED_PACKAGE=installer/mac/build/Symphony_Signed_${PKG_VERSION}_${PARENT_BUILD_VERSION}.pkg
productsign --sign "Developer ID Installer: Symphony Communication Services LLC" $PACKAGE $SIGNED_PACKAGE
echo "Signing Package complete: ${PACKAGE}"
# Notarize the app
xcrun altool --notarize-app --primary-bundle-id "$BUNDLE_ID" --username "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --file $SIGNED_PACKAGE > /tmp/notarize.txt
cat /tmp/notarize.txt
REQUEST_ID=$(sed -n '2p' /tmp/notarize.txt)
REQUEST_ID=$(echo $REQUEST_ID | cut -d "=" -f 2)
echo "$REQUEST_ID"
#xcrun altool --notarization-info $REQUEST_ID --username "$APPLE_ID" --password "$APPLE_ID_PASSWORD"
#xcrun stapler staple $SIGNED_PACKAGE
#stapler validate --verbose $SIGNED_PACKAGE
# Generate Installation Instructions PDF
if ! [ -x "$(command -v markdown-pdf)" ]; then
echo 'Markdown PDF does not exist! Installing it' >&2
npm install -g markdown-pdf
fi
ARCHIVE_NAME="${PKG_VERSION}_${PARENT_BUILD_VERSION}"
echo "Generating PDF for installation instructions"
markdown-pdf installer/mac/install_instructions_mac.md
# Create targets directory
mkdir -p targets
# Attach artifacts to build
if [ "${EXPIRY_PERIOD}" != "0" ]; then
cp $SIGNED_PACKAGE "targets/Symphony-macOS-${PKG_VERSION}-${PARENT_BUILD_VERSION}-TTL-${EXPIRY_PERIOD}.pkg"
cp installer/mac/install_instructions_mac.pdf "targets/Install-Instructions-macOS-${PKG_VERSION}-${PARENT_BUILD_VERSION}-TTL-${EXPIRY_PERIOD}.pdf"
else
cp $SIGNED_PACKAGE "targets/Symphony-macOS-${PKG_VERSION}-${PARENT_BUILD_VERSION}.pkg"
cp installer/mac/install_instructions_mac.pdf "targets/Install-Instructions-macOS-${PKG_VERSION}-${PARENT_BUILD_VERSION}.pdf"
fi
echo "All done, job successfull :)"

View File

@ -58,3 +58,117 @@ IF "%EXPIRY_PERIOD%"=="" (
echo "Running tests, code coverage, linting and building..."
call npm run unpacked-win
echo "Updating 64 bit installer file with hashed passwd..."
set hashedPasswdFile=%HASHED_PASSWORD_FILE_PATH%
if NOT EXIST %hashedPasswdFile% (
echo "can not find hashed password file in: " %hashedPasswdFile%
exit /b -1
)
set /p hashedPasswd=<%hashedPasswdFile%
set installerFile=installer\win\Symphony-x64.aip
if NOT EXIST %installerFile% (
echo "can not find installer file in: " %installerFile%
exit /b -1
)
call powershell -Command "(get-content %installerFile%) | foreach-object {$_ -replace '4A99BAA4D493EE030480AF53BA42EA11CCFB627AB1800400DA9692073D68C522A10A4FD0B5F78525294E51AC7194D55B5EE1D31F', '%hashedPasswd%'} | set-content %installerFile%"
echo "creating 64 bit msi..."
rem add AdvancedInstaller.com to PATH
set PATH="%PATH%";C:\Program Files\nodejs\;C:\Program Files (x86)\Caphyon\Advanced Installer 15.9\bin\x86
echo %PATH%
call node -e "console.log(require('./package.json').version);" > version.txt
set /p baseVer=<version.txt
set SYMVER=%baseVer%
if NOT DEFINED SYMVER (
echo "environment variable SYMVER not defined"
exit /b -1
)
echo "creating targets directory for symphony version: " %SYMVER%
rmdir /q /s targets
mkdir targets
set targetsDir="%CD%\targets\"
IF "%EXPIRY_PERIOD%"=="0" (
set archiveName=Symphony-Win64-%SYMVER%-%PARENT_BUILD_VERSION%
) else (
set archiveName=Symphony-Win64-%SYMVER%-%PARENT_BUILD_VERSION%-TTL-%EXPIRY_PERIOD%
)
set installerDir="%CD%\installer\win"
set distDir="%CD%\dist"
if NOT EXIST "%PFX_DIR%\%PFX_FILE%" (
echo "can not find .pfx file" "%pfxDir%\%pfxFile%"
exit /b -1
)
copy /y "%PFX_DIR%\%PFX_FILE%" "%installerDir%\%PFX_FILE%"
cd %installerDir%
set AIP=Symphony-x64
if EXIST %AIP%-cache (
echo "remove old msi cache file"
rmdir /q /s %AIP%-cache
)
if EXIST %AIP%-SetupFiles (
echo "remove old msi setup files"
rmdir /q /s %AIP%-SetupFiles
)
echo "Running Advanced Installer to build MSI"
call AdvancedInstaller.com /edit %AIP%.aip /SetVersion %SYMVER%
IF %errorlevel% neq 0 (
echo "failed to set advanced installer build version"
exit /b -1
)
call AdvancedInstaller.com /build %AIP%.aip
IF %errorlevel% neq 0 (
echo "error returned from advanced installer:" %errorlevel%
exit /b -1
)
if NOT EXIST %AIP%-SetupFiles/%AIP%.msi (
echo "Failure - Did not produce MSI"
exit /b -1
)
echo "Copying MSI result to target dir"
copy "%AIP%-SetupFiles\%AIP%.msi" "%targetsDir%\%archiveName%.msi"
echo "Building new installer with Wix Sharp"
call "BuildWixSharpInstaller.bat"
if NOT EXIST %SIGNING_FILE_PATH% (
echo Signing failed, 'signing.bat' not found.
exit /b -1
)
call %SIGNING_FILE_PATH%
copy "WixSharpInstaller\Symphony.msi" "%targetsDir%\%archiveName%.msi"
echo "Setting up markdown to pdf package"
%SystemRoot%\System32\where.exe /q markdown-pdf
if ERRORLEVEL 1 (
echo "Markdown to PDF package missing, installing it now."
call npm install -g markdown-pdf
)
echo "Generating installation instructions"
call %appdata%\npm\markdown-pdf install_instructions_win.md
copy install_instructions_win.pdf "%targetsDir%\Install-Instructions-%archiveName%.pdf"
echo "All done, job successfull :)"

View File

@ -1,117 +0,0 @@
@echo off
echo "Running jenkins-win64.bat"
call "scripts\build-win64.bat"
echo "updating 64 bit installer file with hashed passwd..."
set hashedPasswdFile=C:\electron-installer\hashedPasswd.txt
if NOT EXIST %hashedPasswdFile% (
echo "can not find hashed password file in: " %hashedPasswdFile%
exit /b -1
)
set /p hashedPasswd=<%hashedPasswdFile%
set installerFile=installer\win\Symphony-x64.aip
if NOT EXIST %installerFile% (
echo "can not find installer file in: " %installerFile%
exit /b -1
)
call powershell -Command "(get-content %installerFile%) | foreach-object {$_ -replace '4A99BAA4D493EE030480AF53BA42EA11CCFB627AB1800400DA9692073D68C522A10A4FD0B5F78525294E51AC7194D55B5EE1D31F', '%hashedPasswd%'} | set-content %installerFile%"
echo "creating 64 bit msi..."
rem add AdvancedInstaller.com to PATH
set PATH="%PATH%";C:\Program Files\nodejs\;C:\Program Files (x86)\Caphyon\Advanced Installer 15.9\bin\x86
echo %PATH%
call node -e "console.log(require('./package.json').version);" > version.txt
set /p baseVer=<version.txt
set SYMVER=%baseVer%
if NOT DEFINED SYMVER (
echo "environment variable SYMVER not defined"
exit /b -1
)
echo "creating targets directory for symphony version: " %SYMVER%
rmdir /q /s targets
mkdir targets
set targetsDir="%CD%\targets\"
IF "%EXPIRY_PERIOD%"=="0" (
set archiveName=Symphony-Win64-%SYMVER%-%PARENT_BUILD_VERSION%
) else (
set archiveName=Symphony-Win64-%SYMVER%-%PARENT_BUILD_VERSION%-TTL-%EXPIRY_PERIOD%
)
set installerDir="%CD%\installer\win"
set distDir="%CD%\dist"
set pfxDir=C:\electron-installer
set pfxFile=Wrapper.Windows.Product.RSA.pkcs12.pfx
if NOT EXIST "%pfxDir%\%pfxFile%" (
echo "can not find .pfx file" "%pfxDir%\%pfxFile%"
exit /b -1
)
copy /y "%pfxDir%\%pfxFile%" "%installerDir%\%pfxFile%"
cd %installerDir%
set AIP=Symphony-x64
if EXIST %AIP%-cache (
echo "remove old msi cache file"
rmdir /q /s %AIP%-cache
)
if EXIST %AIP%-SetupFiles (
echo "remove old msi setup files"
rmdir /q /s %AIP%-SetupFiles
)
echo "running advanced installer to build msi"
call AdvancedInstaller.com /edit %AIP%.aip /SetVersion %SYMVER%
IF %errorlevel% neq 0 (
echo "failed to set advanced installer build version"
exit /b -1
)
call AdvancedInstaller.com /build %AIP%.aip
IF %errorlevel% neq 0 (
echo "error returned from advanced installer:" %errorlevel%
exit /b -1
)
if NOT EXIST %AIP%-SetupFiles/%AIP%.msi (
echo "failure did not produce msi"
exit /b -1
)
echo "copy msi result to target dir"
copy "%AIP%-SetupFiles\%AIP%.msi" "%targetsDir%\Legacy-%archiveName%.msi"
echo Building new installer with wix#
call "BuildWixSharpInstaller.bat"
if NOT EXIST c:\electron-installer\signing.bat (
echo Signing failed, 'signing.bat' not found.
exit /b -1
)
call c:\electron-installer\signing.bat
copy "WixSharpInstaller\Symphony.msi" "%targetsDir%\%archiveName%.msi"
echo Setup for install instructions
%SystemRoot%\System32\where.exe /q markdown-pdf
if ERRORLEVEL 1 (
call npm install -g markdown-pdf
)
echo Generating install instructions
call %appdata%\npm\markdown-pdf install_instructions_win.md
copy install_instructions_win.pdf "%targetsDir%\Install-Instructions-%archiveName%.pdf"