Update windows.yml

This commit is contained in:
TheTank20 2025-07-23 11:42:42 -05:00 committed by GitHub
parent 32353cc35f
commit 3dfd6eb9aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,3 +66,89 @@ jobs:
with:
name: xpmgr (x64)
path: .\build\xpmgr_x64.exe
compress:
runs-on: windows-latest
steps:
- name: Cache TDM-GCC
id: cache-gcc
uses: actions/cache/restore@v4
with:
path: |
C:\TDM-GCC-64
key: TDM-GCC-10.3.0
- name: Setup TDM-GCC
if: steps.cache-gcc.outputs.cache-hit != 'true'
run: |
Write-Host Downloading TDM-GCC v10.3.0...
Invoke-WebRequest -Uri 'https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm64-2/tdm64-gcc-10.3.0-2.exe' -OutFile 'C:\Windows\temp\TDM-GCC-64.exe'
Write-Host Creating directory...
New-Item -ItemType Directory -Path 'C:\TDM-GCC-64'
Write-Host Copying files [Set 1/3]...
Start-Process '7z' -ArgumentList 'e C:\Windows\temp\TDM-GCC-64.exe -oC:\TDM-GCC-64 -y' -Wait
Write-Host Copying files [Set 2/3]...
Start-Process '7z' -ArgumentList 'e C:\TDM-GCC-64\*.tar.xz -oC:\TDM-GCC-64 -y' -Wait
Write-Host Copying files [Set 3/3]...
Start-Process '7z' -ArgumentList 'x C:\TDM-GCC-64\*.tar -oC:\TDM-GCC-64 -y' -Wait
- name: Save TDM-GCC
uses: actions/cache/save@v4
if: steps.cache-gcc.outputs.cache-hit != 'true'
with:
path: |
C:\TDM-GCC-64
key: TDM-GCC-10.3.0
- name: Setup UPX
run: |
Invoke-WebRequest -Uri 'https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-win64.zip' -OutFile 'C:\Windows\temp\upx.zip'
Write-Host Creating directory...
New-Item -ItemType Directory -Path 'C:\UPX'
Write-Host Copying files...
Expand-Archive -Path 'C:\Windows\temp\upx.zip' -DestinationPath 'C:\UPX'
Write-Host Adding environment variables...
$env:PATH = 'C:\UPX\upx-5.0.2-win64;' + $env:PATH
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
- name: Download x86 artifact
uses: actions/download-artifact@v4
with:
name: xpmgr (x86)
path: .\build\x86
- name: Download x64 artifact
uses: actions/download-artifact@v4
with:
name: xpmgr (x64)
path: .\build\x64
- name: Compress binaries
shell: pwsh
run: |
# Strip symbols
strip .\build\x86\xpmgr_x86.exe
strip .\build\x64\xpmgr_x64.exe
# Remove resources
llvm-objcopy --remove-section .rsrc .\build\x86\xpmgr_x86.exe .\actions_upload\xpmgr_x86_comp.exe
llvm-objcopy --remove-section .rsrc .\build\x64\xpmgr_x64.exe .\actions_upload\xpmgr_x64_comp.exe
# Compress with UPX
& "C:\UPX\upx-5.0.2-win64\upx.exe" --best --ultra-brute .\actions_upload\xpmgr_x86_comp.exe
& "C:\UPX\upx-5.0.2-win64\upx.exe" --best --ultra-brute .\actions_upload\xpmgr_x64_comp.exe
Rename-Item -Path .\actions_upload\xpmgr_x86_comp.exe -NewName xpmgr_x86.exe
Rename-Item -Path .\actions_upload\xpmgr_x64_comp.exe -NewName xpmgr_x64.exe
- name: Upload build artifact (x86)
uses: actions/upload-artifact@v4.6.2
with:
name: xpmgr (x86, compressed)
path: .\actions_upload\xpmgr_x86.exe
- name: Upload build artifact (x64)
uses: actions/upload-artifact@v4.6.2
with:
name: xpmgr (x64, compressed)
path: .\actions_upload\xpmgr_x64.exe