-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_codeql_bundle_dist.ps1
More file actions
59 lines (42 loc) · 1.59 KB
/
build_codeql_bundle_dist.ps1
File metadata and controls
59 lines (42 loc) · 1.59 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
param(
[Parameter(Mandatory = $true)]
[string]
$Version,
[Parameter(Mandatory = $true)]
[string]
$WorkDirectory,
[Parameter(Mandatory = $true)]
[string]
$DestinationDirectory
)
if (-not (Test-Path $WorkDirectory)) {
New-Item -ItemType Directory -Path $WorkDirectory | Out-Null
}
if (-not (Test-Path $DestinationDirectory)) {
New-Item -ItemType Directory -Path $DestinationDirectory | Out-Null
}
# download a copy of the release from GitHub
gh release download "v$Version" --repo https://github.com/advanced-security/codeql-bundle -D $WorkDirectory -A zip
# extract the zip file
Expand-Archive -Path "$WorkDirectory\codeql-bundle-$Version.zip" -DestinationPath $WorkDirectory
# creates a directory named `codeql-bundle-<version>`
$ArchiveDirectory = Join-Path $WorkDirectory "codeql-bundle-$Version"
Push-Location $ArchiveDirectory
# at this point python should already be installed as well as poetry
# export the requirements
poetry export -f requirements.txt > requirements.txt
# install the requirements
pip install -r requirements.txt
Push-Location "codeql_bundle"
# pyinstaller should also be installed
pyinstaller -F -n codeql_bundle cli.py
Pop-Location
Pop-Location
if ($IsWindows) {
$OutputFile = Join-Path $ArchiveDirectory "codeql_bundle" "dist" "codeql_bundle.exe"
}
else {
$OutputFile = Join-Path $ArchiveDirectory "codeql_bundle" "dist" "codeql_bundle"
}
# this will output the binary in the `dist` directory - we should copy that binary the toplevel directory.
Copy-Item -Path $OutputFile -Destination $DestinationDirectory