2019-08-28 09:05:10 -05:00
|
|
|
:: Check to ensure that the VSDev command prompt is in the below location
|
|
|
|
echo "Starting VSDev Command Prompt"
|
2021-03-12 00:03:02 -06:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
|
2019-08-28 09:05:10 -05:00
|
|
|
|
2019-08-27 06:08:26 -05:00
|
|
|
echo %PATH%
|
|
|
|
|
2019-08-28 09:05:10 -05:00
|
|
|
set DISABLE_REBUILD=true
|
2023-06-15 04:12:03 -05:00
|
|
|
set NODE_REQUIRED_VERSION=18.16.0
|
2020-04-01 09:17:52 -05:00
|
|
|
set SNYK_ORG=sda
|
2020-11-10 03:41:39 -06:00
|
|
|
set SNYK_PROJECT_NAME="Symphony Desktop Application"
|
2024-04-15 05:42:55 -05:00
|
|
|
set SCREENSHARE_INDICATOR_PATH="node_modules\screen-share-indicator-frame\ScreenShareIndicatorFrame.exe"
|
|
|
|
set NATIVE_WINDOW_HANDLE_PATH="node_modules\symphony-native-window-handle-helper\SymphonyNativeWindowHandleHelper.exe"
|
|
|
|
set SCREEN_SNIPPET_PATH="node_modules\screen-snippet\ScreenSnippet.exe"
|
|
|
|
set SYMPHONY_EXE_PATH=%WORKSPACE%\dist\win-unpacked\Symphony.exe
|
|
|
|
set SYMPHONY_MSI_PATH="WixSharpInstaller\Symphony.msi"
|
2019-08-28 09:05:10 -05:00
|
|
|
|
2019-08-27 06:08:26 -05:00
|
|
|
set PATH=%PATH%;C:\Program Files\nodejs\;C:\Program Files\Git\cmd
|
|
|
|
echo %PATH%
|
|
|
|
|
|
|
|
set PATH=%PATH%;C:\Program Files (x86)\GnuWin32\bin
|
|
|
|
echo %PATH%
|
|
|
|
|
2019-12-30 09:36:47 -06:00
|
|
|
call nvm install %NODE_REQUIRED_VERSION%
|
|
|
|
call nvm use %NODE_REQUIRED_VERSION%
|
2019-12-12 06:03:37 -06:00
|
|
|
|
2021-03-12 00:03:02 -06:00
|
|
|
call npm config set msvs_version 2017
|
|
|
|
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets
|
|
|
|
|
2019-12-30 09:36:47 -06:00
|
|
|
WHERE gulp
|
2019-08-28 09:30:29 -05:00
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
2019-12-30 09:36:47 -06:00
|
|
|
echo "GULP does not exist. Installing it."
|
|
|
|
call npm i gulp -g
|
2019-08-28 09:05:10 -05:00
|
|
|
)
|
|
|
|
|
2019-12-30 09:36:47 -06:00
|
|
|
WHERE snyk
|
2019-08-28 09:30:29 -05:00
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
2019-12-30 09:36:47 -06:00
|
|
|
echo "Snyk does not exist! Installing and setting it up"
|
|
|
|
call npm i snyk -g
|
2019-08-28 09:05:10 -05:00
|
|
|
)
|
2022-07-25 02:11:48 -05:00
|
|
|
|
2020-04-01 09:35:15 -05:00
|
|
|
echo "Setting snyk org to %SNYK_ORG% and api token to %SNYK_API_TOKEN%"
|
|
|
|
call snyk config set org=%SNYK_ORG%
|
|
|
|
call snyk config set api=%SNYK_API_TOKEN%
|
2019-08-28 09:05:10 -05:00
|
|
|
|
2019-08-27 06:08:26 -05:00
|
|
|
:: Below command replaces buildVersion with the appropriate build number from jenkins
|
2023-02-09 07:09:26 -06:00
|
|
|
sed -i -e "s/\"buildNumber\"[[:space:]]*\:[[:space:]]*\".*\"/\"buildNumber\": \"%PARENT_BUILD_VERSION%\"/g" package.json
|
2023-06-15 04:12:03 -05:00
|
|
|
sed -i -e "s/\"version\"[[:space:]]*\:[[:space:]]\"\(.*\)\"/\"version\": \"\1-%PARENT_BUILD_VERSION%\"/g" package.json
|
2019-08-27 06:08:26 -05:00
|
|
|
|
2019-12-30 09:36:47 -06:00
|
|
|
echo "Installing dependencies..."
|
2019-08-27 06:08:26 -05:00
|
|
|
call npm install
|
|
|
|
|
2024-04-15 05:42:55 -05:00
|
|
|
echo "Sign screen-share indicator..."
|
|
|
|
echo %SS_FOLDER%
|
|
|
|
call smctl sign --fingerprint %DIGICERT_FINGERPRINT% --input %SCREENSHARE_INDICATOR_PATH% --tool signtool --verbose
|
|
|
|
smctl sign verify --input node_modules\screen-share-indicator-frame\ScreenShareIndicatorFrame.exe
|
2023-02-08 04:36:23 -06:00
|
|
|
|
2024-04-22 19:23:33 -05:00
|
|
|
smctl sign --tool signtool --fingerprint %DIGICERT_FINGERPRINT% --input %NATIVE_WINDOW_HANDLE_PATH% --file-name
|
2024-04-15 05:42:55 -05:00
|
|
|
smctl sign verify --input %NATIVE_WINDOW_HANDLE_PATH%
|
2023-02-08 04:36:23 -06:00
|
|
|
|
2022-07-25 02:11:48 -05:00
|
|
|
IF %errorlevel% neq 0 (
|
|
|
|
echo "Signing failed"
|
|
|
|
exit /b -1
|
|
|
|
)
|
|
|
|
|
2024-04-22 19:23:33 -05:00
|
|
|
smctl sign --tool signtool --fingerprint %DIGICERT_FINGERPRINT% --input %SCREEN_SNIPPET_PATH% --file-name
|
2024-04-15 05:42:55 -05:00
|
|
|
smctl sign verify --input %SCREEN_SNIPPET_PATH%
|
|
|
|
|
2022-07-25 02:11:48 -05:00
|
|
|
IF %errorlevel% neq 0 (
|
|
|
|
echo "Signing failed"
|
|
|
|
exit /b -1
|
|
|
|
)
|
|
|
|
|
2019-12-30 09:36:47 -06:00
|
|
|
# Run Snyk Security Tests
|
|
|
|
echo "Running snyk security tests"
|
2020-11-10 03:41:39 -06:00
|
|
|
call snyk test --file=package-lock.json --org=%SNYK_ORG%
|
|
|
|
call snyk monitor --file=package-lock.json --org=%SNYK_ORG% --project-name=%SNYK_PROJECT_NAME%
|
2019-12-30 09:36:47 -06:00
|
|
|
|
2019-08-28 09:05:10 -05:00
|
|
|
:: Set expiry if required
|
2019-08-28 09:30:29 -05:00
|
|
|
IF "%EXPIRY_PERIOD%"=="" (
|
2019-08-28 09:05:10 -05:00
|
|
|
echo "Not setting expiry for the build!"
|
|
|
|
) else (
|
|
|
|
echo "Setting expiry to days: %EXPIRY_PERIOD%"
|
|
|
|
call gulp setExpiry --period %EXPIRY_PERIOD%
|
|
|
|
)
|
|
|
|
|
|
|
|
echo "Running tests, code coverage, linting and building..."
|
2019-08-27 06:08:26 -05:00
|
|
|
call npm run unpacked-win
|
2020-12-15 06:44:22 -06:00
|
|
|
|
|
|
|
echo "creating 64 bit msi..."
|
|
|
|
|
|
|
|
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" (
|
2023-02-09 07:09:26 -06:00
|
|
|
set archiveName=Symphony-Win64-%SYMVER%
|
2020-12-15 06:44:22 -06:00
|
|
|
) else (
|
2023-02-09 07:09:26 -06:00
|
|
|
set archiveName=Symphony-Win64-%SYMVER%-TTL-%EXPIRY_PERIOD%
|
2020-12-15 06:44:22 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
set installerDir="%CD%\installer\win"
|
|
|
|
set distDir="%CD%\dist"
|
2020-12-16 08:35:58 -06:00
|
|
|
set rootDir="%CD%"
|
2020-12-15 06:44:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
cd %installerDir%
|
|
|
|
|
2024-04-15 05:42:55 -05:00
|
|
|
echo "Signing Symphony.exe file.."
|
2024-04-22 19:23:33 -05:00
|
|
|
smctl sign --tool signtool --fingerprint %DIGICERT_FINGERPRINT% --input %SYMPHONY_EXE_PATH% --file-name
|
2024-04-15 05:42:55 -05:00
|
|
|
smctl sign verify --input %SYMPHONY_EXE_PATH%
|
2021-02-11 01:21:11 -06:00
|
|
|
IF %errorlevel% neq 0 (
|
|
|
|
echo "Signing failed"
|
|
|
|
exit /b -1
|
|
|
|
)
|
|
|
|
|
2024-04-22 19:23:33 -05:00
|
|
|
set SYMPHONY_SYMVER_EXE_PATH=%WORKSPACE%\dist\Symphony-%SYMVER%-win.exe
|
2024-04-15 05:42:55 -05:00
|
|
|
echo "Signing Symphony-SYMVER-win.exe file.."
|
2024-04-22 19:23:33 -05:00
|
|
|
smctl sign --tool signtool --fingerprint %DIGICERT_FINGERPRINT% --input %SYMPHONY_SYMVER_EXE_PATH% --file-name
|
2024-04-15 05:42:55 -05:00
|
|
|
smctl sign verify --input %SYMPHONY_SYMVER_EXE_PATH%
|
2022-07-20 04:00:16 -05:00
|
|
|
IF %errorlevel% neq 0 (
|
|
|
|
echo "Signing failed"
|
|
|
|
exit /b -1
|
|
|
|
)
|
|
|
|
|
2021-02-11 01:21:11 -06:00
|
|
|
|
2022-08-02 06:57:47 -05:00
|
|
|
node ..\..\scripts\windows_update_checksum.js "..\..\dist\Symphony-%SYMVER%-win.exe" "..\..\dist\latest.yml"
|
2022-07-25 02:11:48 -05:00
|
|
|
|
2021-02-11 01:21:11 -06:00
|
|
|
echo "Building new installer with Wix Sharp"
|
|
|
|
call "BuildWixSharpInstaller.bat"
|
|
|
|
|
2024-04-15 05:42:55 -05:00
|
|
|
echo "Signing MSI file.."
|
2024-04-22 19:23:33 -05:00
|
|
|
signtool sign /d Symphony /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 %DIGICERT_FINGERPRINT% %SYMPHONY_MSI_PATH%
|
2024-04-15 05:42:55 -05:00
|
|
|
smctl sign verify --input %SYMPHONY_MSI_PATH%
|
2021-02-11 01:21:11 -06:00
|
|
|
IF %errorlevel% neq 0 (
|
|
|
|
echo "Failed to sign installer"
|
|
|
|
exit /b -1
|
|
|
|
)
|
2020-12-22 07:55:50 -06:00
|
|
|
|
|
|
|
echo "Copying New MSI installer to target dir"
|
2020-12-15 06:44:22 -06:00
|
|
|
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
|
2020-12-16 07:58:07 -06:00
|
|
|
copy install_instructions_win.pdf "%targetsDir%\Install-Instructions-%archiveName%.pdf"
|
2020-12-15 09:48:38 -06:00
|
|
|
|
|
|
|
echo Generate release notes
|
2020-12-16 08:40:01 -06:00
|
|
|
cd %rootDir%
|
2020-12-15 09:48:38 -06:00
|
|
|
call %appdata%\npm\markdown-pdf RELEASE_NOTES.md
|
|
|
|
copy RELEASE_NOTES.pdf "%targetsDir%\Release-Notes-%archiveName%.pdf"
|
2020-12-15 06:44:22 -06:00
|
|
|
|
2021-03-18 03:31:41 -05:00
|
|
|
echo "All done, job successful :)"
|