Skip to content

Commit 84f37d9

Browse files
committed
Github action for package
1 parent e36aea4 commit 84f37d9

File tree

4 files changed

+141
-2
lines changed

4 files changed

+141
-2
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: C2Core Release (Linux)
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
test-linux:
11+
runs-on: ubuntu-22.04
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install dependencies
20+
run: sudo apt-get update && sudo apt-get install -y cmake g++ curl make libssl-dev libsmbclient-dev pkg-config
21+
22+
- name: Configure CMake
23+
run: cmake -S . -B build -DC2CORE_BUILD_TESTS=OFF
24+
25+
- name: Build Release
26+
run: cmake --build build --parallel
27+
28+
- name: Install to package/
29+
run: cmake --install build --prefix "$GITHUB_WORKSPACE/package"
30+
31+
- name: Prepare release bundle (installed files + Modules)
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
ws="$GITHUB_WORKSPACE"
36+
pkg="$ws/package"
37+
dest="$pkg/LinuxModules"
38+
mkdir -p "$dest"
39+
40+
# Try common places the Modules output might land
41+
found=""
42+
for c in "$ws/Release/Modules"; do
43+
if [[ -d "$c" ]]; then
44+
echo "Found Modules at: $c"
45+
shopt -s dotglob nullglob
46+
cp -a "$c"/* "$dest"/ || true
47+
found="yes"
48+
break
49+
fi
50+
done
51+
if [[ -z "$found" ]]; then
52+
echo "::warning::Modules directory not found in known locations; LinuxModules will be empty."
53+
fi
54+
55+
# Tar the installed tree
56+
tarball="$ws/C2Core-Linux.tar.gz"
57+
tar -C "$pkg" -czf "$tarball" .
58+
echo "Created $tarball"
59+
60+
- name: Upload GitHub Release
61+
uses: svenstaro/upload-release-action@v2
62+
with:
63+
repo_token: ${{ secrets.GITHUB_TOKEN }}
64+
file: C2Core-Linux.tar.gz
65+
asset_name: C2Core-Linux.tar.gz
66+
tag: linux-${{ github.run_number }}
67+
overwrite: true
68+
body: "C2Core Linux release: installed files + LinuxModules."
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: C2Core Release (Windows)
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
test-windows:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Add MSBuild to PATH
18+
uses: microsoft/setup-msbuild@v2
19+
with:
20+
msbuild-architecture: x64
21+
22+
- name: Configure CMake (Release, no tests)
23+
run: cmake -G "Visual Studio 17 2022" -A x64 -S . -B build -DC2CORE_BUILD_TESTS=OFF
24+
25+
- name: Build (Release)
26+
run: cmake --build build --config Release --parallel
27+
28+
- name: Install to package/
29+
run: cmake --install build --config Release --prefix "${{ github.workspace }}\\package"
30+
31+
- name: Prepare release bundle (installed files + Modules)
32+
shell: pwsh
33+
run: |
34+
$ws = $env:GITHUB_WORKSPACE
35+
$pkg = Join-Path $ws 'package'
36+
$dest = Join-Path $pkg 'WindowsModules'
37+
New-Item -ItemType Directory -Force -Path $dest | Out-Null
38+
39+
# Try common places the Modules output might land
40+
$candidates = @(
41+
Join-Path $ws 'Release\Modules',
42+
)
43+
44+
$found = $false
45+
foreach ($c in $candidates) {
46+
if (Test-Path $c) {
47+
Write-Host "Found Modules at: $c"
48+
Copy-Item -Recurse -Force -Path (Join-Path $c '*') -Destination $dest
49+
$found = $true
50+
break
51+
}
52+
}
53+
if (-not $found) {
54+
Write-Warning "Modules directory not found in known locations; WindowsModules will be empty."
55+
}
56+
57+
# Zip the installed tree
58+
$zip = Join-Path $ws 'C2Core-Windows.zip'
59+
if (Test-Path $zip) { Remove-Item $zip -Force }
60+
Compress-Archive -Path (Join-Path $pkg '*') -DestinationPath $zip
61+
Write-Host "Created $zip"
62+
63+
- name: Upload GitHub Release
64+
uses: svenstaro/upload-release-action@v2
65+
with:
66+
repo_token: ${{ secrets.GITHUB_TOKEN }}
67+
file: C2Core-Windows.zip
68+
asset_name: C2Core-Windows.zip
69+
tag: windows-${{ github.run_number }}
70+
overwrite: true
71+
body: "C2Core Windows release: installed files + WindowsModules."

.github/workflows/Tests_Linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout repository
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- name: Install dependencies
1818
run: sudo apt-get update && sudo apt-get install -y cmake g++ curl make libssl-dev libsmbclient-dev pkg-config

.github/workflows/Tests_Windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout repository
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- name: Add msbuild to PATH
1818
uses: microsoft/[email protected]

0 commit comments

Comments
 (0)