Skip to content

Commit d005d35

Browse files
committed
add build CI
1 parent 50fbd47 commit d005d35

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup MSBuild
17+
uses: microsoft/setup-msbuild@v2
18+
19+
- name: Setup NuGet
20+
uses: NuGet/setup-nuget@v2
21+
22+
- name: Restore NuGet packages
23+
run: nuget restore BundleManager.sln
24+
25+
- name: Build solution
26+
run: msbuild BundleManager.sln /m /p:Configuration=Release
27+
28+
- name: Remove debug symbols and non-Windows binaries
29+
shell: pwsh
30+
run: |
31+
$patterns = @('*.pdb', '*.dylib', '*.so')
32+
foreach ($pattern in $patterns) {
33+
Get-ChildItem -Path . -Recurse -File -Filter $pattern |
34+
Where-Object { $_.FullName -match '\\(bin|obj)\\Release\\' } |
35+
Remove-Item -Force -ErrorAction SilentlyContinue
36+
}
37+
38+
- name: Remove empty folders recursively
39+
shell: pwsh
40+
run: |
41+
$roots = Get-ChildItem -Path . -Directory -Recurse |
42+
Where-Object { $_.FullName -match '\\(bin|obj)\\Release(\\|$)' }
43+
44+
do {
45+
$removed = 0
46+
$emptyDirs = $roots |
47+
Sort-Object { $_.FullName.Length } -Descending |
48+
Where-Object { $_.Exists } |
49+
Where-Object { (Get-ChildItem -Path $_.FullName -Force | Measure-Object).Count -eq 0 }
50+
51+
foreach ($dir in $emptyDirs) {
52+
Remove-Item -Path $dir.FullName -Force -ErrorAction SilentlyContinue
53+
$removed++
54+
}
55+
} while ($removed -gt 0)
56+
57+
- name: Upload build artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: BundleManager-Release
61+
if-no-files-found: warn
62+
path: |
63+
**/bin/Release/**
64+
**/obj/Release/**

0 commit comments

Comments
 (0)