ci: add desktop app build workflow

This commit is contained in:
ihmily
2026-07-06 01:57:39 +08:00
parent eb3a313f9e
commit 6ab5a644eb

114
.github/workflows/build-desktop.yml vendored Normal file
View File

@@ -0,0 +1,114 @@
name: Build Desktop Apps
on:
workflow_dispatch:
inputs:
build_windows:
description: Build the Windows package
type: boolean
default: true
build_macos:
description: Build the macOS package
type: boolean
default: true
refresh_flet:
description: Re-download the Flet desktop archive
type: boolean
default: false
permissions:
contents: read
concurrency:
group: build-desktop-${{ github.ref }}
cancel-in-progress: false
jobs:
build-windows:
name: Build Windows
if: ${{ inputs.build_windows }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Prepare bundled FFmpeg
run: python scripts/download_ffmpeg.py --platform windows
- name: Prepare bundled Node.js
run: python scripts/download_nodejs.py --platform windows --windows-arch x64
- name: Build app
run: |
$refreshArg = if ("${{ inputs.refresh_flet }}" -eq "true") { "--refresh-flet" } else { "" }
python scripts/build.py --platform windows $refreshArg
- name: Package zip
run: Compress-Archive -Path dist/StreamCap/* -DestinationPath dist/StreamCap-windows.zip -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: StreamCap-windows
path: dist/StreamCap-windows.zip
if-no-files-found: error
build-macos:
name: Build macOS
if: ${{ inputs.build_macos }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Prepare bundled FFmpeg
run: python scripts/download_ffmpeg.py --platform macos
- name: Prepare bundled Node.js
run: python scripts/download_nodejs.py --platform macos
- name: Build app
run: |
REFRESH_ARG=""
if [ "${{ inputs.refresh_flet }}" = "true" ]; then
REFRESH_ARG="--refresh-flet"
fi
python scripts/build.py --platform macos $REFRESH_ARG
- name: Package dmg
run: hdiutil create -volname "StreamCap" -srcfolder "dist/StreamCap.app" -ov -format UDZO "dist/StreamCap-macos.dmg"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: StreamCap-macos
path: dist/StreamCap-macos.dmg
if-no-files-found: error