Fix dev console, async override icons, remove native menu, suppress c… #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Avalonia (Cross-Platform) | |
| on: | |
| push: | |
| branches: [avalonia] | |
| pull_request: | |
| branches: [avalonia] | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| rid: win-x64 | |
| artifact: EmoTracker-win-x64 | |
| - os: macos-latest | |
| rid: osx-x64 | |
| artifact: EmoTracker-osx-x64 | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| artifact: EmoTracker-osx-arm64 | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| artifact: EmoTracker-linux-x64 | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| # Allow restoring the net8.0-windows target on non-Windows (skips WPF-specific build) | |
| EnableWindowsTargeting: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Publish | |
| run: dotnet publish EmoTracker/EmoTracker.csproj --framework net8.0 --configuration Release --runtime ${{ matrix.rid }} --self-contained --output publish/raw | |
| - name: Create macOS app bundle | |
| if: startsWith(matrix.rid, 'osx') | |
| run: | | |
| APP="publish/${{ matrix.artifact }}/EmoTracker.app" | |
| mkdir -p "$APP/Contents/MacOS" | |
| mkdir -p "$APP/Contents/Resources" | |
| # Copy published output into the bundle | |
| cp -R publish/raw/* "$APP/Contents/MacOS/" | |
| cp EmoTracker/macOS/Info.plist "$APP/Contents/" | |
| chmod +x "$APP/Contents/MacOS/EmoTracker" | |
| # Convert .ico to .icns for the app icon | |
| python3 -m venv .venv | |
| source .venv/bin/activate | |
| pip install --quiet Pillow | |
| python3 -c " | |
| from PIL import Image, ImageDraw | |
| import os | |
| ico = Image.open('EmoTracker/emohead_icon_transparent_7h3_icon.ico') | |
| # Extract the largest frame from the ICO | |
| best = None | |
| for size in sorted(ico.info.get('sizes', [(ico.width, ico.height)]), reverse=True): | |
| ico.size = size | |
| candidate = ico.copy().convert('RGBA') | |
| if best is None or candidate.width > best.width: | |
| best = candidate | |
| src = best | |
| iconset = 'EmoTracker.iconset' | |
| os.makedirs(iconset, exist_ok=True) | |
| def make_icon(src, s): | |
| # Create black rounded-rect background, composite icon on top | |
| bg = Image.new('RGBA', (s, s), (0, 0, 0, 0)) | |
| draw = ImageDraw.Draw(bg) | |
| r = max(s // 5, 4) | |
| draw.rounded_rectangle([0, 0, s - 1, s - 1], radius=r, fill=(0, 0, 0, 255)) | |
| resized = src.resize((s, s), Image.LANCZOS) | |
| bg.paste(resized, (0, 0), resized) | |
| return bg | |
| sizes = [16, 32, 64, 128, 256, 512] | |
| for s in sizes: | |
| icon = make_icon(src, s) | |
| icon.save(os.path.join(iconset, f'icon_{s}x{s}.png')) | |
| if s >= 32: | |
| half = s // 2 | |
| icon.save(os.path.join(iconset, f'icon_{half}x{half}@2x.png')) | |
| icon = make_icon(src, 1024) | |
| icon.save(os.path.join(iconset, 'icon_512x512@2x.png')) | |
| " | |
| iconutil -c icns EmoTracker.iconset -o "$APP/Contents/Resources/EmoTracker.icns" | |
| # Ad-hoc code sign so macOS doesn't report the bundle as damaged | |
| codesign --force --deep -s - "$APP" | |
| - name: Create macOS tar.gz | |
| if: startsWith(matrix.rid, 'osx') | |
| run: | | |
| cd publish/${{ matrix.artifact }} | |
| tar czf ../EmoTracker-${{ matrix.rid }}.tar.gz EmoTracker.app | |
| - name: Upload macOS artifact | |
| if: startsWith(matrix.rid, 'osx') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: publish/EmoTracker-${{ matrix.rid }}.tar.gz | |
| - name: Create Linux tar.xz | |
| if: startsWith(matrix.rid, 'linux') | |
| run: | | |
| chmod +x publish/raw/EmoTracker | |
| cd publish/raw | |
| tar cJf ../EmoTracker-${{ matrix.rid }}.tar.xz . | |
| - name: Upload Linux artifact | |
| if: startsWith(matrix.rid, 'linux') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: publish/EmoTracker-${{ matrix.rid }}.tar.xz | |
| - name: Stage Windows output | |
| if: startsWith(matrix.rid, 'win') | |
| run: | | |
| mkdir -p publish/${{ matrix.artifact }} | |
| cp -R publish/raw/* publish/${{ matrix.artifact }}/ | |
| - name: Upload Windows artifact | |
| if: startsWith(matrix.rid, 'win') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: publish/${{ matrix.artifact }} |