Refactor GitHub Actions workflow for packaging and improve error handling

- Updated packaging commands in the release workflow to use Windows-compatible commands for copying files.
- Enhanced error handling for missing files and directories during the packaging process.
- Improved formatting of the Info.plist generation for better readability.
- Adjusted the shell used in the packaging step to be platform-specific, ensuring compatibility across different operating systems.
This commit is contained in:
scawful
2025-09-27 22:09:06 -04:00
parent 6dfc446e23
commit 505c91a97d
2 changed files with 49 additions and 41 deletions

View File

@@ -115,11 +115,11 @@ jobs:
artifact_path: "build/bin/Release/"
package_cmd: |
mkdir package
cp -r build/bin/Release/* package/
cp -r assets package/
cp LICENSE package/
cp README.md package/
cd package && 7z a ../yaze-windows-x64.zip *
xcopy /E /I build\bin\Release\* package\
xcopy /E /I assets package\assets
copy LICENSE package\
copy README.md package\
cd package && 7z a ..\yaze-windows-x64.zip *
- name: "Windows x86"
os: windows-2022
@@ -130,11 +130,11 @@ jobs:
artifact_path: "build/bin/Release/"
package_cmd: |
mkdir package
cp -r build/bin/Release/* package/
cp -r assets package/
cp LICENSE package/
cp README.md package/
cd package && 7z a ../yaze-windows-x86.zip *
xcopy /E /I build\bin\Release\* package\
xcopy /E /I assets package\assets
copy LICENSE package\
copy README.md package\
cd package && 7z a ..\yaze-windows-x86.zip *
- name: "macOS Universal"
os: macos-14
@@ -172,35 +172,35 @@ jobs:
else
# Create a basic Info.plist
VERSION_NUM=$(echo "${{ needs.validate-and-prepare.outputs.tag_name }}" | sed 's/^v//')
cat > "Yaze.app/Contents/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>yaze</string>
<key>CFBundleIdentifier</key>
<string>com.yaze.editor</string>
<key>CFBundleName</key>
<string>Yaze</string>
<key>CFBundleVersion</key>
<string>$VERSION_NUM</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION_NUM</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
cat > "Yaze.app/Contents/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>yaze</string>
<key>CFBundleIdentifier</key>
<string>com.yaze.editor</string>
<key>CFBundleName</key>
<string>Yaze</string>
<key>CFBundleVersion</key>
<string>$VERSION_NUM</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION_NUM</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
fi
fi
# Create DMG
mkdir dmg_staging
cp -r Yaze.app dmg_staging/
cp LICENSE dmg_staging/
cp README.md dmg_staging/
cp -r docs dmg_staging/
cp LICENSE dmg_staging/ 2>/dev/null || echo "LICENSE not found"
cp README.md dmg_staging/ 2>/dev/null || echo "README.md not found"
cp -r docs dmg_staging/ 2>/dev/null || echo "docs directory not found"
hdiutil create -srcfolder dmg_staging -format UDZO -volname "Yaze ${{ needs.validate-and-prepare.outputs.tag_name }}" yaze-macos.dmg
- name: "Linux x64"
@@ -210,10 +210,10 @@ EOF
package_cmd: |
mkdir package
cp build/bin/yaze package/
cp -r assets package/
cp -r docs package/
cp LICENSE package/
cp README.md package/
cp -r assets package/ 2>/dev/null || echo "assets directory not found"
cp -r docs package/ 2>/dev/null || echo "docs directory not found"
cp LICENSE package/ 2>/dev/null || echo "LICENSE not found"
cp README.md package/ 2>/dev/null || echo "README.md not found"
tar -czf yaze-linux-x64.tar.gz -C package .
runs-on: ${{ matrix.os }}
@@ -439,6 +439,14 @@ EOF
run: |
$ErrorActionPreference = "Stop"
# Debug: List build directory contents
Write-Host "Build directory contents:" -ForegroundColor Cyan
if (Test-Path "build") {
Get-ChildItem -Recurse build -Name | Select-Object -First 20
} else {
Write-Host "build directory does not exist" -ForegroundColor Red
}
# Determine executable path based on platform
if ("${{ runner.os }}" -eq "Windows") {
$exePath = "build\bin\${{ env.BUILD_TYPE }}\yaze.exe"
@@ -473,7 +481,7 @@ EOF
# Package
- name: Package
shell: bash
shell: ${{ runner.os == 'Windows' && 'cmd' || 'bash' }}
run: ${{ matrix.package_cmd }}
# Create release with artifacts (will create release if it doesn't exist)

View File

@@ -251,14 +251,14 @@ void LoadSystemFonts() {
if (result == ERROR_SUCCESS && valueCount > 0) {
// Allocate buffers with proper size limits
const size_t maxNameSize = std::min(static_cast<size_t>(maxValueNameSize) + 1, size_t(1024));
const size_t maxDataSize = std::min(static_cast<size_t>(maxValueDataSize) + 1, size_t(4096));
const size_t maxNameSize = (std::min)(static_cast<size_t>(maxValueNameSize) + 1, size_t(1024));
const size_t maxDataSize = (std::min)(static_cast<size_t>(maxValueDataSize) + 1, size_t(4096));
std::vector<char> valueName(maxNameSize);
std::vector<BYTE> valueData(maxDataSize);
// Enumerate font entries (limit to prevent excessive loading)
const DWORD maxFontsToLoad = std::min(valueCount, DWORD(50));
const DWORD maxFontsToLoad = (std::min)(valueCount, DWORD(50));
for (DWORD i = 0; i < maxFontsToLoad; i++) {
DWORD valueNameSize = static_cast<DWORD>(maxNameSize);