4
4
$Version ,
5
5
[Parameter (Mandatory = $true )]
6
6
[string ]
7
- $OutputDirectory
7
+ $WorkDirectory ,
8
+
9
+ [Parameter (Mandatory = $true )]
10
+ [string ]
11
+ $DestinationDirectory
8
12
)
9
13
14
+ if (-not (Test-Path $WorkDirectory )) {
15
+ New-Item - ItemType Directory - Path $WorkDirectory | Out-Null
16
+ }
10
17
11
- # create output directory if it doesn't exist
12
- if (-not (Test-Path $OutputDirectory )) {
13
- New-Item - ItemType Directory - Path $OutputDirectory | Out-Null
18
+ if (-not (Test-Path $DestinationDirectory )) {
19
+ New-Item - ItemType Directory - Path $DestinationDirectory | Out-Null
14
20
}
15
21
16
22
# download a copy of the release from GitHub
17
- gh release download " v$Version " -- repo https:// github.com / rvermeulen/ codeql- bundle - D $OutputDirectory - A zip
23
+ gh release download " v$Version " -- repo https:// github.com / rvermeulen/ codeql- bundle - D $WorkDirectory - A zip
18
24
19
25
# extract the zip file
20
- Expand-Archive - Path " $OutputDirectory \codeql-bundle-$Version .zip" - DestinationPath $OutputDirectory
26
+ Expand-Archive - Path " $WorkDirectory \codeql-bundle-$Version .zip" - DestinationPath $WorkDirectory
21
27
22
28
# creates a directory named `codeql-bundle-<version>`
23
- $ArchiveDirectory = Join-Path $OutputDirectory " codeql-bundle-$Version "
29
+ $ArchiveDirectory = Join-Path $WorkDirectory " codeql-bundle-$Version "
24
30
25
31
Push-Location $ArchiveDirectory
26
32
@@ -36,13 +42,17 @@ Push-Location "codeql_bundle"
36
42
# pyinstaller should also be installed
37
43
pyinstaller -F - n codeql_bundle cli.py
38
44
39
-
40
45
Pop-Location
41
46
Pop-Location
42
47
43
- $OutputFile = Join-Path $ArchiveDirectory " codeql_bundle" " dist" " codeql_bundle.exe"
48
+ if ($IsWindows ){
49
+ $OutputFile = Join-Path $ArchiveDirectory " codeql_bundle" " dist" " codeql_bundle.exe"
50
+ }else {
51
+ $OutputFile = Join-Path $ArchiveDirectory " codeql_bundle" " dist" " codeql_bundle"
52
+ }
53
+
44
54
45
55
# this will output the binary in the `dist` directory - we should copy that binary the toplevel directory.
46
- Copy-Item - Path $OutputFile - Destination $OutputDirectory
56
+ Copy-Item - Path $OutputFile - Destination $DestinationDirectory
47
57
48
58
0 commit comments