Skip to content

Commit d51cc82

Browse files
committed
bundle codeql bundle
1 parent 372d6e1 commit d51cc82

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

.github/workflows/internal-build-release-linux64.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,33 @@ jobs:
3737
chmod +x ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/qlt
3838
chmod +r -R ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64
3939
40+
41+
- uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.11'
44+
45+
- name: Build CodeQL Bundle Tool for Packaging
46+
shell: pwsh
47+
run: |
48+
# need this for the bundling to work.
49+
pip install -U pyinstaller
50+
51+
./scripts/build_codeql_bundle_dist.ps1 -Version 0.2.0 -WorkDirectory dist -DestinationDirectory ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64/tools/
52+
53+
54+
- name: Build Bundle Archive
55+
shell: bash
56+
run: |
57+
echo "Current Directory $(pwd)"
58+
4059
# create bundle
4160
ARCHIVE="$(pwd)/qlt-linux-x86_64.zip"
4261
pushd ./src/CodeQLToolkit.Core/bin/Release/net6.0/publish/linux-x64
4362
zip -r $ARCHIVE .
4463
popd
4564
65+
66+
4667
- name: Upload build artifacts
4768
uses: actions/upload-artifact@v3
4869
with:

scripts/build_codeql_bundle_dist.ps1

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,29 @@ param(
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

2531
Push-Location $ArchiveDirectory
2632

@@ -36,13 +42,17 @@ Push-Location "codeql_bundle"
3642
# pyinstaller should also be installed
3743
pyinstaller -F -n codeql_bundle cli.py
3844

39-
4045
Pop-Location
4146
Pop-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

src/CodeQLToolkit.Core/CodeQLToolkit.Core.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,5 @@
3030
<None Update="ver.txt">
3131
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3232
</None>
33-
</ItemGroup>
34-
33+
</ItemGroup>
3534
</Project>

0 commit comments

Comments
 (0)