Skip to content

Commit 83380e5

Browse files
committed
Enable self-contained, trimmed, compressed single-file builds
Updated build and test workflows and project settings to produce self-contained, single-file executables with trimming, ReadyToRun, and compression enabled. Removed creation and handling of release zip archives, and updated checksum generation to reflect the new output. These changes reduce executable size and simplify release artifacts.
1 parent e73cd08 commit 83380e5

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

.github/workflows/build-release.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ jobs:
6060
dotnet publish FFmpegInstaller.csproj `
6161
-c Release `
6262
-r win-x64 `
63-
--self-contained false `
63+
--self-contained true `
6464
-p:PublishSingleFile=true `
65-
-p:PublishReadyToRun=false `
66-
-p:PublishTrimmed=false `
65+
-p:PublishReadyToRun=true `
66+
-p:PublishTrimmed=true `
67+
-p:EnableCompressionInSingleFile=true `
6768
-o ./publish
6869
6970
- name: Verify build output
@@ -73,21 +74,14 @@ jobs:
7374
Write-Host "✓ FFmpegInstaller.exe found"
7475
$fileSize = (Get-Item "./publish/FFmpegInstaller.exe").Length / 1MB
7576
Write-Host "File size: $($fileSize.ToString('F2')) MB"
77+
78+
# Copy to root for release
79+
Copy-Item "./publish/FFmpegInstaller.exe" "./FFmpegInstaller.exe"
7680
} else {
7781
Write-Error "FFmpegInstaller.exe not found!"
7882
exit 1
7983
}
8084
81-
- name: Create release archive
82-
shell: pwsh
83-
run: |
84-
Compress-Archive -Path "./publish/FFmpegInstaller.exe" `
85-
-DestinationPath "./FFmpegInstaller-${{ steps.get_version.outputs.VERSION }}.zip"
86-
87-
# Also keep the standalone exe
88-
Copy-Item "./publish/FFmpegInstaller.exe" `
89-
"./FFmpegInstaller.exe"
90-
9185
- name: Generate release notes
9286
id: release_notes
9387
shell: pwsh
@@ -121,17 +115,12 @@ jobs:
121115
$exeHash = (Get-FileHash -Path "./FFmpegInstaller.exe" -Algorithm SHA256).Hash
122116
Write-Host "FFmpegInstaller.exe SHA256: $exeHash"
123117
124-
# Calculate SHA256 for the zip
125-
$zipHash = (Get-FileHash -Path "./FFmpegInstaller-${{ steps.get_version.outputs.VERSION }}.zip" -Algorithm SHA256).Hash
126-
Write-Host "FFmpegInstaller.zip SHA256: $zipHash"
127-
128118
# Save checksums to file
129119
@"
130-
# SHA256 Checksums
120+
# SHA256 Checksum
131121
132122
``````
133123
$exeHash FFmpegInstaller.exe
134-
$zipHash FFmpegInstaller-${{ steps.get_version.outputs.VERSION }}.zip
135124
``````
136125
"@ | Out-File -FilePath checksums.txt -Encoding utf8
137126
@@ -148,7 +137,6 @@ jobs:
148137
body_path: release_notes.md
149138
files: |
150139
FFmpegInstaller.exe
151-
FFmpegInstaller-${{ steps.get_version.outputs.VERSION }}.zip
152140
checksums.txt
153141
env:
154142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -159,7 +147,6 @@ jobs:
159147
name: ffmpeg-installer-v${{ steps.get_version.outputs.VERSION }}
160148
path: |
161149
FFmpegInstaller.exe
162-
FFmpegInstaller-${{ steps.get_version.outputs.VERSION }}.zip
163150
checksums.txt
164151
release_notes.md
165152
retention-days: 30

.github/workflows/build-test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ jobs:
5757
dotnet publish FFmpegInstaller.csproj `
5858
-c Release `
5959
-r win-x64 `
60-
--self-contained false `
60+
--self-contained true `
6161
-p:PublishSingleFile=true `
62-
-p:PublishReadyToRun=false `
63-
-p:PublishTrimmed=false `
62+
-p:PublishReadyToRun=true `
63+
-p:PublishTrimmed=true `
64+
-p:EnableCompressionInSingleFile=true `
6465
-o ./publish
6566
6667
- name: Verify build output

FFmpegInstaller.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616

1717
<!-- Single file executable configuration -->
1818
<PublishSingleFile>true</PublishSingleFile>
19-
<SelfContained>false</SelfContained>
20-
<PublishReadyToRun>false</PublishReadyToRun>
21-
<PublishTrimmed>false</PublishTrimmed>
19+
<SelfContained>true</SelfContained>
20+
<PublishReadyToRun>true</PublishReadyToRun>
21+
<PublishTrimmed>true</PublishTrimmed>
22+
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
23+
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
24+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
2225

2326
<!-- High DPI and icon settings -->
2427
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>

0 commit comments

Comments
 (0)