Repository navigation
Expand file tree
/
Copy pathbuild.ps1
More file actions
119 lines (94 loc) · 5.22 KB
/
Copy pathbuild.ps1
File metadata and controls
119 lines (94 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# .\build.ps1 true
#
# NOTES:
# 1. File versioning will not work if the directory for this repo is a Dropbox, OneDrive dir etc
# 2. AV scanning needs to be temporarily suspended
#
$signparam=$args[0]
if ($signparam -eq "true") {
$sign = $true
Write-Output "Binaries and package will be signed. Ensure smart token is installed before pressing enter..."
pause
} else {
$sign = $false
}
$cwd = Get-Location
$org = "stackql"
$repo = "stackql"
$Product = "StackQL - Query and Provision Cloud Services using SQL."
$FileDescription = "StackQL Executable"
$IconPath = ".\inc\stackql.ico"
$LegalCopyright = "Copyright (c) 2020-2025 StackQL Studios. All rights reserved."
Write-Output "*******************************************************************************"
Write-Output "Clearing msi and bin directories"
Write-Output "*******************************************************************************"
# Remove contents in the 'msi' directory
if (Test-Path -Path .\msi) {
Get-ChildItem -Path .\msi\* -Force | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
Write-Output "'msi' directory contents removed."
} else {
Write-Output "'msi' directory does not exist, skipping."
}
# Remove contents in the 'bin' directory
if (Test-Path -Path .\bin) {
Get-ChildItem -Path .\bin\* -Force | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
Write-Output "'bin' directory contents removed."
} else {
Write-Output "'bin' directory does not exist, skipping."
}
Write-Output "*******************************************************************************"
Write-Output "Downloading latest build from ${org}/${repo}"
Write-Output "*******************************************************************************"
Expand-Archive -Path "downloaded/stackql_windows_amd64.zip" -Force -DestinationPath "bin/"
Write-Output "*******************************************************************************"
Write-Output "Removing previous MSI and EXE"
Write-Output "*******************************************************************************"
Remove-Item -Path .\msi\* -Force -ErrorAction SilentlyContinue
Write-Output "*******************************************************************************"
Write-Output "Versioning EXE"
Write-Output "*******************************************************************************"
$VersionOutput = .\bin\stackql.exe --version
Write-Output $VersionOutput
$Version = ($VersionOutput -split '\n')[0].Split("v")[1].Split(" W")[0]
$env:StackQLBuildVersion = $Version
Write-Output "Version: ${Version}"
Write-Output "Setting File Properties..."
.\lib\rcedit-x86.exe .\bin\stackql.exe `
--set-product-version "${Version}" `
--set-file-version "${Version}" `
--set-version-string "ProductName" "${Product}" `
--set-version-string "FileDescription" "${FileDescription}" `
--set-version-string "LegalCopyright" "${LegalCopyright}" `
--set-icon $IconPath
Write-Output "File Properties Set..."
if ($sign) {
Write-Output "*******************************************************************************"
Write-Output "Signing EXE..."
Write-Output "*******************************************************************************"
.\lib\signtool sign /tr http://timestamp.comodoca.com /td sha256 /fd sha256 /n StackQL .\bin\stackql.exe
}
Write-Output "*******************************************************************************"
Write-Output "Compiling and Linking WiX source file using WiX v4..."
Write-Output "*******************************************************************************"
# Compile and link in one step with WiX v4
# wix.exe build .\stackql.wxs -o .\msi\stackql.msi
wix.exe build .\stackql.wxs -ext WixToolset.UI.wixext -o .\msi\stackql.msi
if ($sign) {
Write-Output "*******************************************************************************"
Write-Output "Signing MSI..."
Write-Output "*******************************************************************************"
.\lib\signtool sign /tr http://timestamp.comodoca.com /td sha256 /fd sha256 /n StackQL .\msi\stackql.msi
}
Write-Output "*******************************************************************************"
Write-Output "Renaming MSI..."
Write-Output "*******************************************************************************"
Rename-Item -Path ".\msi\stackql.msi" -NewName "stackql_${Version}_windows_amd64.msi"
Write-Output "*******************************************************************************"
Write-Output "Copying and Renaming MSI..."
Write-Output "*******************************************************************************"
Copy-Item ".\msi\stackql_${Version}_windows_amd64.msi" -Destination ".\msi\stackql_windows_amd64.msi"
Write-Output "*******************************************************************************"
Write-Output "Creating ZIP file from Signed EXE..."
Write-Output "*******************************************************************************"
Compress-Archive -Path ".\bin\stackql.exe" -Update -DestinationPath ".\msi\stackql_${Version}_windows_amd64.zip"
Copy-Item ".\msi\stackql_${Version}_windows_amd64.zip" -Destination ".\msi\stackql_windows_amd64.zip"