Add cross-platform packaging and CI

- macOS .app bundle script (osx-arm64, Info.plist)
- Linux AppImage script (linux-x64, .desktop file)
- GitHub Actions CI: build/test/publish for all 3 platforms
This commit is contained in:
montanon 2026-03-15 10:51:37 -03:00
parent 7b972c9980
commit ce0fe52e53
5 changed files with 132 additions and 0 deletions

49
.github/workflows/build-avalonia.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Build PKHeX Avalonia
on:
push:
branches: [ avalonia-cross-platform ]
pull_request:
branches: [ avalonia-cross-platform ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
rid: linux-x64
- os: macos-latest
rid: osx-arm64
- os: windows-latest
rid: win-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
dotnet-quality: 'preview'
- name: Restore
run: dotnet restore PKHeX.Avalonia/PKHeX.Avalonia.csproj
- name: Build
run: dotnet build PKHeX.Avalonia/PKHeX.Avalonia.csproj --no-restore -c Release
- name: Test
run: dotnet test Tests/PKHeX.Core.Tests/PKHeX.Core.Tests.csproj --no-restore
- name: Publish
run: dotnet publish PKHeX.Avalonia/PKHeX.Avalonia.csproj -c Release -r ${{ matrix.rid }} --self-contained -o publish/${{ matrix.rid }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PKHeX-${{ matrix.rid }}
path: publish/${{ matrix.rid }}/

View File

@ -0,0 +1,22 @@
#!/bin/bash
APP_NAME="PKHeX"
PUBLISH_DIR="bin/publish/linux-x64"
dotnet publish ../PKHeX.Avalonia.csproj -c Release -r linux-x64 --self-contained -o "$PUBLISH_DIR"
# Create AppDir structure
APP_DIR="${APP_NAME}.AppDir"
mkdir -p "${APP_DIR}/usr/bin"
mkdir -p "${APP_DIR}/usr/share/icons/hicolor/256x256/apps"
cp -R "${PUBLISH_DIR}/"* "${APP_DIR}/usr/bin/"
cp pkhex.desktop "${APP_DIR}/"
# cp pkhex.png "${APP_DIR}/usr/share/icons/hicolor/256x256/apps/"
cat > "${APP_DIR}/AppRun" << 'APPRUN'
#!/bin/bash
HERE=$(dirname "$(readlink -f "$0")")
exec "$HERE/usr/bin/PKHeX.Avalonia" "$@"
APPRUN
chmod +x "${APP_DIR}/AppRun"
echo "Created ${APP_DIR} - use appimagetool to create .AppImage"

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=PKHeX
Comment=Pokemon Save Editor
Exec=PKHeX.Avalonia
Icon=pkhex
Type=Application
Categories=Utility;Game;

View File

@ -0,0 +1,37 @@
<?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>CFBundleName</key>
<string>PKHeX</string>
<key>CFBundleDisplayName</key>
<string>PKHeX - Pokemon Save Editor</string>
<key>CFBundleIdentifier</key>
<string>com.pkhex.avalonia</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleExecutable</key>
<string>PKHeX.Avalonia</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.data</string>
</array>
</dict>
</array>
</dict>
</plist>

View File

@ -0,0 +1,17 @@
#!/bin/bash
# Creates a macOS .app bundle for PKHeX Avalonia
APP_NAME="PKHeX"
PUBLISH_DIR="bin/publish/osx-arm64"
APP_DIR="${APP_NAME}.app"
# Build
dotnet publish ../PKHeX.Avalonia.csproj -c Release -r osx-arm64 --self-contained -o "$PUBLISH_DIR"
# Create .app structure
mkdir -p "${APP_DIR}/Contents/MacOS"
mkdir -p "${APP_DIR}/Contents/Resources"
cp -R "${PUBLISH_DIR}/"* "${APP_DIR}/Contents/MacOS/"
cp Info.plist "${APP_DIR}/Contents/"
# cp icon.icns "${APP_DIR}/Contents/Resources/" # Add icon later
echo "Created ${APP_DIR}"