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:
84
.github/workflows/release.yml
vendored
84
.github/workflows/release.yml
vendored
@@ -115,11 +115,11 @@ jobs:
|
|||||||
artifact_path: "build/bin/Release/"
|
artifact_path: "build/bin/Release/"
|
||||||
package_cmd: |
|
package_cmd: |
|
||||||
mkdir package
|
mkdir package
|
||||||
cp -r build/bin/Release/* package/
|
xcopy /E /I build\bin\Release\* package\
|
||||||
cp -r assets package/
|
xcopy /E /I assets package\assets
|
||||||
cp LICENSE package/
|
copy LICENSE package\
|
||||||
cp README.md package/
|
copy README.md package\
|
||||||
cd package && 7z a ../yaze-windows-x64.zip *
|
cd package && 7z a ..\yaze-windows-x64.zip *
|
||||||
|
|
||||||
- name: "Windows x86"
|
- name: "Windows x86"
|
||||||
os: windows-2022
|
os: windows-2022
|
||||||
@@ -130,11 +130,11 @@ jobs:
|
|||||||
artifact_path: "build/bin/Release/"
|
artifact_path: "build/bin/Release/"
|
||||||
package_cmd: |
|
package_cmd: |
|
||||||
mkdir package
|
mkdir package
|
||||||
cp -r build/bin/Release/* package/
|
xcopy /E /I build\bin\Release\* package\
|
||||||
cp -r assets package/
|
xcopy /E /I assets package\assets
|
||||||
cp LICENSE package/
|
copy LICENSE package\
|
||||||
cp README.md package/
|
copy README.md package\
|
||||||
cd package && 7z a ../yaze-windows-x86.zip *
|
cd package && 7z a ..\yaze-windows-x86.zip *
|
||||||
|
|
||||||
- name: "macOS Universal"
|
- name: "macOS Universal"
|
||||||
os: macos-14
|
os: macos-14
|
||||||
@@ -172,35 +172,35 @@ jobs:
|
|||||||
else
|
else
|
||||||
# Create a basic Info.plist
|
# Create a basic Info.plist
|
||||||
VERSION_NUM=$(echo "${{ needs.validate-and-prepare.outputs.tag_name }}" | sed 's/^v//')
|
VERSION_NUM=$(echo "${{ needs.validate-and-prepare.outputs.tag_name }}" | sed 's/^v//')
|
||||||
cat > "Yaze.app/Contents/Info.plist" << EOF
|
cat > "Yaze.app/Contents/Info.plist" <<EOF
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>yaze</string>
|
<string>yaze</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.yaze.editor</string>
|
<string>com.yaze.editor</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>Yaze</string>
|
<string>Yaze</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$VERSION_NUM</string>
|
<string>$VERSION_NUM</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$VERSION_NUM</string>
|
<string>$VERSION_NUM</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create DMG
|
# Create DMG
|
||||||
mkdir dmg_staging
|
mkdir dmg_staging
|
||||||
cp -r Yaze.app dmg_staging/
|
cp -r Yaze.app dmg_staging/
|
||||||
cp LICENSE dmg_staging/
|
cp LICENSE dmg_staging/ 2>/dev/null || echo "LICENSE not found"
|
||||||
cp README.md dmg_staging/
|
cp README.md dmg_staging/ 2>/dev/null || echo "README.md not found"
|
||||||
cp -r docs dmg_staging/
|
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
|
hdiutil create -srcfolder dmg_staging -format UDZO -volname "Yaze ${{ needs.validate-and-prepare.outputs.tag_name }}" yaze-macos.dmg
|
||||||
|
|
||||||
- name: "Linux x64"
|
- name: "Linux x64"
|
||||||
@@ -210,10 +210,10 @@ EOF
|
|||||||
package_cmd: |
|
package_cmd: |
|
||||||
mkdir package
|
mkdir package
|
||||||
cp build/bin/yaze package/
|
cp build/bin/yaze package/
|
||||||
cp -r assets package/
|
cp -r assets package/ 2>/dev/null || echo "assets directory not found"
|
||||||
cp -r docs package/
|
cp -r docs package/ 2>/dev/null || echo "docs directory not found"
|
||||||
cp LICENSE package/
|
cp LICENSE package/ 2>/dev/null || echo "LICENSE not found"
|
||||||
cp README.md package/
|
cp README.md package/ 2>/dev/null || echo "README.md not found"
|
||||||
tar -czf yaze-linux-x64.tar.gz -C package .
|
tar -czf yaze-linux-x64.tar.gz -C package .
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -439,6 +439,14 @@ EOF
|
|||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = "Stop"
|
$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
|
# Determine executable path based on platform
|
||||||
if ("${{ runner.os }}" -eq "Windows") {
|
if ("${{ runner.os }}" -eq "Windows") {
|
||||||
$exePath = "build\bin\${{ env.BUILD_TYPE }}\yaze.exe"
|
$exePath = "build\bin\${{ env.BUILD_TYPE }}\yaze.exe"
|
||||||
@@ -473,7 +481,7 @@ EOF
|
|||||||
|
|
||||||
# Package
|
# Package
|
||||||
- name: Package
|
- name: Package
|
||||||
shell: bash
|
shell: ${{ runner.os == 'Windows' && 'cmd' || 'bash' }}
|
||||||
run: ${{ matrix.package_cmd }}
|
run: ${{ matrix.package_cmd }}
|
||||||
|
|
||||||
# Create release with artifacts (will create release if it doesn't exist)
|
# Create release with artifacts (will create release if it doesn't exist)
|
||||||
|
|||||||
@@ -251,14 +251,14 @@ void LoadSystemFonts() {
|
|||||||
|
|
||||||
if (result == ERROR_SUCCESS && valueCount > 0) {
|
if (result == ERROR_SUCCESS && valueCount > 0) {
|
||||||
// Allocate buffers with proper size limits
|
// Allocate buffers with proper size limits
|
||||||
const size_t maxNameSize = std::min(static_cast<size_t>(maxValueNameSize) + 1, size_t(1024));
|
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 maxDataSize = (std::min)(static_cast<size_t>(maxValueDataSize) + 1, size_t(4096));
|
||||||
|
|
||||||
std::vector<char> valueName(maxNameSize);
|
std::vector<char> valueName(maxNameSize);
|
||||||
std::vector<BYTE> valueData(maxDataSize);
|
std::vector<BYTE> valueData(maxDataSize);
|
||||||
|
|
||||||
// Enumerate font entries (limit to prevent excessive loading)
|
// 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++) {
|
for (DWORD i = 0; i < maxFontsToLoad; i++) {
|
||||||
DWORD valueNameSize = static_cast<DWORD>(maxNameSize);
|
DWORD valueNameSize = static_cast<DWORD>(maxNameSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user