-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and sign Windows installer (#1702)
- Loading branch information
1 parent
edddf04
commit 2a79d80
Showing
2 changed files
with
67 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,68 @@ | ||
@echo on | ||
|
||
REM replace with one from environment | ||
set RELEASE_TYPE=dev | ||
|
||
aws s3 ls %STAGE_URL% --recursive | ||
|
||
heat.exe /? | ||
candle.exe /? | ||
light.exe /? | ||
|
||
|
||
REM heat.exe dir dist\\snow\\_internal ^ | ||
REM -gg ^ | ||
REM -cg SnowflakeCLIInternalFiles ^ | ||
REM -dr TESTFILEPRODUCTDIR ^ | ||
REM -var var.SnowflakeCLIInternalFiles ^ | ||
REM -sfrag ^ | ||
REM -o _internal.wxs | ||
REM | ||
REM candle.exe ^ | ||
REM -arch x64 ^ | ||
REM -dSnowflakeCLIVersion=%CLI_VERSION% ^ | ||
REM -dSnowflakeCLIInternalFiles=dist\\snow\\_internal ^ | ||
REM scripts\packaging\win\snowflake_cli.wxs ^ | ||
REM scripts\packaging\win\snowflake_cli_exitdlg.wxs ^ | ||
REM _internal.wxs | ||
REM | ||
REM light.exe ^ | ||
REM -ext WixUIExtension ^ | ||
REM -ext WixUtilExtension ^ | ||
REM -cultures:en-us ^ | ||
REM -loc scripts\packaging\win\snowflake_cli_en-us.wxl ^ | ||
REM -out snowflake-cli-%CLI_VERSION%-x86_64.msi ^ | ||
REM snowflake_cli.wixobj ^ | ||
REM snowflake_cli_exitdlg.wixobj ^ | ||
REM _internal.wixobj | ||
set PATH=C:\Program Files\7-Zip;C:\Users\jenkins\AppData\Local\Programs\Python\Python38;C:\Users\jenkins\AppData\Local\Programs\Python\Python38\Scripts;C:\Program Files (x86)\WiX Toolset v3.11\bin;%PATH% | ||
|
||
python.exe --version | ||
python.exe -c "import platform as p; print(f'{p.system()=}, {p.architecture()=}')" | ||
|
||
python.exe -m pip install hatch | ||
FOR /F "delims=" %%I IN ('hatch run packaging:win-build-version') DO SET CLI_VERSION=%%I | ||
FOR /F "delims=" %%I IN ('git rev-parse %svnRevision%') DO SET REVISION=%%I | ||
FOR /F "delims=" %%I IN ('echo %releaseType%') DO SET RELEASE_TYPE=%%I | ||
|
||
echo CLI_VERSION = %CLI_VERSION% | ||
echo REVISION = %REVISION%` | ||
echo RELEASE_TYPE = %RELEASE_TYPE%` | ||
|
||
set CLI_ZIP=snowflake-cli-%CLI_VERSION%.zip | ||
set CLI_MSI=snowflake-cli-%CLI_VERSION%-x86_64.msi | ||
set STAGE_URL=s3://sfc-eng-jenkins/repository/snowflake-cli/staging/%RELEASE_TYPE%/windows_x86_64/%REVISION% | ||
set RELEASE_URL=s3://sfc-eng-jenkins/repository/snowflake-cli/%RELEASE_TYPE%/windows_x86_64/%REVISION% | ||
|
||
echo "[INFO] downloading artifacts" | ||
cmd /c aws s3 cp %STAGE_URL%/%CLI_ZIP% . || goto :error | ||
|
||
echo "[INFO] building installer" | ||
7z x %CLI_ZIP% || goto :error | ||
|
||
signtool sign /debug /sm /d "Snowflake CLI" /t http://timestamp.digicert.com /a dist\snow\snow.exe || goto :error | ||
signtool verify /v /pa dist\snow\snow.exe || goto :error | ||
|
||
heat.exe dir dist\snow\_internal ^ | ||
-gg ^ | ||
-cg SnowflakeCLIInternalFiles ^ | ||
-dr TESTFILEPRODUCTDIR ^ | ||
-var var.SnowflakeCLIInternalFiles ^ | ||
-sfrag ^ | ||
-o _internal.wxs || goto :error | ||
|
||
candle.exe ^ | ||
-arch x64 ^ | ||
-dSnowflakeCLIVersion=%CLI_VERSION% ^ | ||
-dSnowflakeCLIInternalFiles=dist\\snow\\_internal ^ | ||
scripts\packaging\win\snowflake_cli.wxs ^ | ||
scripts\packaging\win\snowflake_cli_exitdlg.wxs ^ | ||
_internal.wxs || goto :error | ||
|
||
light.exe ^ | ||
-ext WixUIExtension ^ | ||
-ext WixUtilExtension ^ | ||
-cultures:en-us ^ | ||
-loc scripts\packaging\win\snowflake_cli_en-us.wxl ^ | ||
-out %CLI_MSI% ^ | ||
snowflake_cli.wixobj ^ | ||
snowflake_cli_exitdlg.wixobj ^ | ||
_internal.wixobj || goto :error | ||
|
||
signtool sign /debug /sm /d "Snowflake CLI" /t http://timestamp.digicert.com /a %CLI_MSI% || goto :error | ||
signtool verify /v /pa %CLI_MSI% || goto :error | ||
|
||
echo "[INFO] uploading artifacts" | ||
cmd /c aws s3 cp %CLI_MSI% %RELEASE_URL%/%CLI_MSI% || goto :error | ||
|
||
REM FINISH SCRIPT EXECUTION HERE | ||
GOTO :EOF | ||
|
||
:error | ||
echo Failed with error code #%errorlevel%. | ||
exit /b %errorlevel% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters