44 $Version ,
55 [Parameter (Mandatory = $true )]
66 [string ]
7- $OutputDirectory
7+ $WorkDirectory ,
8+
9+ [Parameter (Mandatory = $true )]
10+ [string ]
11+ $DestinationDirectory
812)
913
14+ if (-not (Test-Path $WorkDirectory )) {
15+ New-Item - ItemType Directory - Path $WorkDirectory | Out-Null
16+ }
1017
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
1420}
1521
1622# 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
1824
1925# 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
2127
2228# creates a directory named `codeql-bundle-<version>`
23- $ArchiveDirectory = Join-Path $OutputDirectory " codeql-bundle-$Version "
29+ $ArchiveDirectory = Join-Path $WorkDirectory " codeql-bundle-$Version "
2430
2531Push-Location $ArchiveDirectory
2632
@@ -36,13 +42,17 @@ Push-Location "codeql_bundle"
3642# pyinstaller should also be installed
3743pyinstaller -F - n codeql_bundle cli.py
3844
39-
4045Pop-Location
4146Pop-Location
4247
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+
4454
4555# 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
4757
4858
0 commit comments