From e2ce1547868024b7cf51b7eff8bf2060a412bd57 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 10:48:00 +0800 Subject: [PATCH 01/23] Create release-sync.yml --- .github/workflows/release-sync.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/release-sync.yml diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml new file mode 100644 index 0000000..a305c67 --- /dev/null +++ b/.github/workflows/release-sync.yml @@ -0,0 +1,15 @@ +name: Sync Upstream Releases + +on: + schedule: + - cron: '0 2 * * *' # 每天凌晨 2 点自动同步 + workflow_dispatch: + +jobs: + release-sync: + runs-on: ubuntu-latest + steps: + - uses: WeiChiaChang/release-sync-action@v1.1.0 + with: + upstream: ihmily/StreamCap # 原始仓库地址 + token: ${{ secrets.GITHUB_TOKEN }} # 使用默认 token 推送到当前 fork 仓库 From 59caf25285062ede8deb738f7f15f752bcff9d76 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 10:51:03 +0800 Subject: [PATCH 02/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index a305c67..e8df1d3 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -1,15 +1,21 @@ -name: Sync Upstream Releases - on: schedule: - - cron: '0 2 * * *' # 每天凌晨 2 点自动同步 + - cron: "0 2 * * *" workflow_dispatch: jobs: - release-sync: + sync_releases: runs-on: ubuntu-latest steps: - - uses: WeiChiaChang/release-sync-action@v1.1.0 - with: - upstream: ihmily/StreamCap # 原始仓库地址 - token: ${{ secrets.GITHUB_TOKEN }} # 使用默认 token 推送到当前 fork 仓库 + - name: Setup GH CLI + uses: cli/cli-action@v2 + - name: Fetch upstream releases + run: | + gh release list --repo upstream-owner/upstream-repo > latest_upstream.txt + gh release list --repo ${{ github.repository }} > latest_fork.txt + - name: Compare and sync + run: | + for tag in $(grep -vFf latest_fork.txt latest_upstream.txt); do + gh release download "$tag" --repo upstream-owner/upstream-repo + gh release create "$tag" <*.zip> --repo ${{ github.repository }} + done From c8713ba47f65f945fe309a0fe7d2526a660d6f54 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 10:54:32 +0800 Subject: [PATCH 03/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 68 ++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index e8df1d3..06e5bbc 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -1,21 +1,65 @@ +name: Sync Upstream Releases + on: schedule: - - cron: "0 2 * * *" - workflow_dispatch: + - cron: '0 3 * * *' # 每天凌晨 3 点执行 + workflow_dispatch: # 支持手动触发 + +env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 用于 gh 命令的认证 jobs: - sync_releases: + sync-release: + name: Sync releases from upstream runs-on: ubuntu-latest + steps: - - name: Setup GH CLI - uses: cli/cli-action@v2 - - name: Fetch upstream releases + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Fetch upstream releases list run: | - gh release list --repo upstream-owner/upstream-repo > latest_upstream.txt - gh release list --repo ${{ github.repository }} > latest_fork.txt - - name: Compare and sync + echo "📥 获取 upstream releases" + gh release list --repo ihmily/StreamCap --limit 100 > upstream.txt + gh release list --limit 100 > my.txt + echo "✅ 列出 upstream release 完成" + + - name: Find new tags + id: find_tags + run: | + comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) > new_tags.txt + echo "🧩 以下是未同步的 tag:" + cat new_tags.txt + echo "new_tags=$(cat new_tags.txt | paste -sd ',' -)" >> "$GITHUB_OUTPUT" + + - name: Sync releases + if: steps.find_tags.outputs.new_tags != '' run: | - for tag in $(grep -vFf latest_fork.txt latest_upstream.txt); do - gh release download "$tag" --repo upstream-owner/upstream-repo - gh release create "$tag" <*.zip> --repo ${{ github.repository }} + echo "🚀 开始同步新 releases" + for tag in $(cat new_tags.txt); do + echo "🔄 同步 release: $tag" + + # 获取 release 的元信息 + release_json=$(gh release view "$tag" --repo ihmily/StreamCap --json tagName,name,body,draft,prerelease) + + name=$(echo "$release_json" | jq -r '.name') + body=$(echo "$release_json" | jq -r '.body') + draft=$(echo "$release_json" | jq -r '.draft') + prerelease=$(echo "$release_json" | jq -r '.prerelease') + + # 下载附件 + gh release download "$tag" --repo ihmily/StreamCap --dir ./downloads || echo "⚠️ 无附件" + + # 创建 release + gh release create "$tag" ./downloads/* \ + --title "$name" \ + --notes "$body" \ + $( [ "$draft" == "true" ] && echo "--draft" ) \ + $( [ "$prerelease" == "true" ] && echo "--prerelease" ) + + echo "✅ Release [$tag] 同步完成" + rm -rf ./downloads done + + - name: 完成提示 + run: echo "🎉 Release 同步流程执行完毕" From 4207e797ed0cfad29239f058a333cc508b0db192 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 10:57:19 +0800 Subject: [PATCH 04/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 37 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index 06e5bbc..a86bf26 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -2,11 +2,11 @@ name: Sync Upstream Releases on: schedule: - - cron: '0 3 * * *' # 每天凌晨 3 点执行 + - cron: '0 3 * * *' # 每天凌晨 3 点自动运行 workflow_dispatch: # 支持手动触发 env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 用于 gh 命令的认证 + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: sync-release: @@ -29,7 +29,7 @@ jobs: run: | comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) > new_tags.txt echo "🧩 以下是未同步的 tag:" - cat new_tags.txt + cat new_tags.txt || echo "(无新 tag)" echo "new_tags=$(cat new_tags.txt | paste -sd ',' -)" >> "$GITHUB_OUTPUT" - name: Sync releases @@ -39,23 +39,32 @@ jobs: for tag in $(cat new_tags.txt); do echo "🔄 同步 release: $tag" - # 获取 release 的元信息 - release_json=$(gh release view "$tag" --repo ihmily/StreamCap --json tagName,name,body,draft,prerelease) + # 获取 release 元信息 + release_json=$(gh release view "$tag" --repo ihmily/StreamCap --json tagName,name,body,isDraft,isPrerelease) name=$(echo "$release_json" | jq -r '.name') body=$(echo "$release_json" | jq -r '.body') - draft=$(echo "$release_json" | jq -r '.draft') - prerelease=$(echo "$release_json" | jq -r '.prerelease') + draft=$(echo "$release_json" | jq -r '.isDraft') + prerelease=$(echo "$release_json" | jq -r '.isPrerelease') - # 下载附件 + # 下载附件(如果有) + mkdir -p downloads gh release download "$tag" --repo ihmily/StreamCap --dir ./downloads || echo "⚠️ 无附件" - # 创建 release - gh release create "$tag" ./downloads/* \ - --title "$name" \ - --notes "$body" \ - $( [ "$draft" == "true" ] && echo "--draft" ) \ - $( [ "$prerelease" == "true" ] && echo "--prerelease" ) + # 创建新 release + if [ -n "$(ls -A ./downloads)" ]; then + gh release create "$tag" ./downloads/* \ + --title "$name" \ + --notes "$body" \ + $( [ "$draft" == "true" ] && echo "--draft" ) \ + $( [ "$prerelease" == "true" ] && echo "--prerelease" ) + else + gh release create "$tag" \ + --title "$name" \ + --notes "$body" \ + $( [ "$draft" == "true" ] && echo "--draft" ) \ + $( [ "$prerelease" == "true" ] && echo "--prerelease" ) + fi echo "✅ Release [$tag] 同步完成" rm -rf ./downloads From 7045cf0443d24c7f081ed21dadcd39aea6ea6c2e Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:00:02 +0800 Subject: [PATCH 05/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index a86bf26..60d9be5 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -27,7 +27,7 @@ jobs: - name: Find new tags id: find_tags run: | - comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) > new_tags.txt + comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) | grep -vE '^\s*$|^-$' > new_tags.txt echo "🧩 以下是未同步的 tag:" cat new_tags.txt || echo "(无新 tag)" echo "new_tags=$(cat new_tags.txt | paste -sd ',' -)" >> "$GITHUB_OUTPUT" @@ -39,19 +39,15 @@ jobs: for tag in $(cat new_tags.txt); do echo "🔄 同步 release: $tag" - # 获取 release 元信息 release_json=$(gh release view "$tag" --repo ihmily/StreamCap --json tagName,name,body,isDraft,isPrerelease) - name=$(echo "$release_json" | jq -r '.name') body=$(echo "$release_json" | jq -r '.body') draft=$(echo "$release_json" | jq -r '.isDraft') prerelease=$(echo "$release_json" | jq -r '.isPrerelease') - # 下载附件(如果有) mkdir -p downloads gh release download "$tag" --repo ihmily/StreamCap --dir ./downloads || echo "⚠️ 无附件" - # 创建新 release if [ -n "$(ls -A ./downloads)" ]; then gh release create "$tag" ./downloads/* \ --title "$name" \ From 6134ebae55794cf4d7cf150afb1fb744d5427417 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:05:12 +0800 Subject: [PATCH 06/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 62 ++++++++++++------------------ 1 file changed, 24 insertions(+), 38 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index 60d9be5..03ce70e 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -1,70 +1,56 @@ -name: Sync Upstream Releases +name: Sync Upstream Releases Only on: schedule: - - cron: '0 3 * * *' # 每天凌晨 3 点自动运行 - workflow_dispatch: # 支持手动触发 + - cron: '0 3 * * *' # 每天凌晨3点自动执行 + workflow_dispatch: # 支持手动手动触发 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - sync-release: - name: Sync releases from upstream + sync-releases: runs-on: ubuntu-latest - steps: - name: Checkout repo uses: actions/checkout@v3 - - name: Fetch upstream releases list + - name: List upstream releases run: | - echo "📥 获取 upstream releases" gh release list --repo ihmily/StreamCap --limit 100 > upstream.txt gh release list --limit 100 > my.txt - echo "✅ 列出 upstream release 完成" - - name: Find new tags - id: find_tags + - name: Find new releases + id: find_new run: | - comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) | grep -vE '^\s*$|^-$' > new_tags.txt - echo "🧩 以下是未同步的 tag:" - cat new_tags.txt || echo "(无新 tag)" - echo "new_tags=$(cat new_tags.txt | paste -sd ',' -)" >> "$GITHUB_OUTPUT" + comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) | grep -vE '^\s*$|^-$' > new_releases.txt + echo "new_releases=$(paste -sd ',' new_releases.txt)" >> $GITHUB_OUTPUT + echo "New releases to sync:" + cat new_releases.txt || echo "(none)" - - name: Sync releases - if: steps.find_tags.outputs.new_tags != '' + - name: Sync new releases + if: steps.find_new.outputs.new_releases != '' run: | - echo "🚀 开始同步新 releases" - for tag in $(cat new_tags.txt); do - echo "🔄 同步 release: $tag" - - release_json=$(gh release view "$tag" --repo ihmily/StreamCap --json tagName,name,body,isDraft,isPrerelease) + for tag in $(cat new_releases.txt); do + echo "Sync release $tag" + release_json=$(gh release view "$tag" --repo ihmily/StreamCap --json name,body,isDraft,isPrerelease) name=$(echo "$release_json" | jq -r '.name') body=$(echo "$release_json" | jq -r '.body') draft=$(echo "$release_json" | jq -r '.isDraft') prerelease=$(echo "$release_json" | jq -r '.isPrerelease') mkdir -p downloads - gh release download "$tag" --repo ihmily/StreamCap --dir ./downloads || echo "⚠️ 无附件" + gh release download "$tag" --repo ihmily/StreamCap --dir downloads || echo "No assets" - if [ -n "$(ls -A ./downloads)" ]; then - gh release create "$tag" ./downloads/* \ - --title "$name" \ - --notes "$body" \ - $( [ "$draft" == "true" ] && echo "--draft" ) \ - $( [ "$prerelease" == "true" ] && echo "--prerelease" ) + if [ "$(ls -A downloads)" ]; then + gh release create "$tag" downloads/* --title "$name" --notes "$body" $( [ "$draft" == "true" ] && echo "--draft" ) $( [ "$prerelease" == "true" ] && echo "--prerelease" ) else - gh release create "$tag" \ - --title "$name" \ - --notes "$body" \ - $( [ "$draft" == "true" ] && echo "--draft" ) \ - $( [ "$prerelease" == "true" ] && echo "--prerelease" ) + gh release create "$tag" --title "$name" --notes "$body" $( [ "$draft" == "true" ] && echo "--draft" ) $( [ "$prerelease" == "true" ] && echo "--prerelease" ) fi - echo "✅ Release [$tag] 同步完成" - rm -rf ./downloads + rm -rf downloads + echo "Release $tag synced" done - - name: 完成提示 - run: echo "🎉 Release 同步流程执行完毕" + - name: Finish + run: echo "Releases sync complete" From 1cddfc2844a821b28927ad33fbc42d097bb13875 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:07:05 +0800 Subject: [PATCH 07/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index 03ce70e..14a5cdc 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -3,7 +3,7 @@ name: Sync Upstream Releases Only on: schedule: - cron: '0 3 * * *' # 每天凌晨3点自动执行 - workflow_dispatch: # 支持手动手动触发 + workflow_dispatch: # 支持手动触发 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -23,7 +23,9 @@ jobs: - name: Find new releases id: find_new run: | - comm -23 <(cut -f1 -d$'\t' upstream.txt | sort) <(cut -f1 -d$'\t' my.txt | sort) | grep -vE '^\s*$|^-$' > new_releases.txt + cut -f1 -d$'\t' upstream.txt | sort > upstream_tags.txt + cut -f1 -d$'\t' my.txt | sort > my_tags.txt + comm -23 upstream_tags.txt my_tags.txt | grep -vE '^\s*$|^-$' > new_releases.txt echo "new_releases=$(paste -sd ',' new_releases.txt)" >> $GITHUB_OUTPUT echo "New releases to sync:" cat new_releases.txt || echo "(none)" From 0f41133778ef4235e79b2a0a7972fcdad3dc95ef Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:10:40 +0800 Subject: [PATCH 08/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index 14a5cdc..698e61f 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -2,8 +2,8 @@ name: Sync Upstream Releases Only on: schedule: - - cron: '0 3 * * *' # 每天凌晨3点自动执行 - workflow_dispatch: # 支持手动触发 + - cron: '0 3 * * *' + workflow_dispatch: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -23,12 +23,14 @@ jobs: - name: Find new releases id: find_new run: | + set +e cut -f1 -d$'\t' upstream.txt | sort > upstream_tags.txt cut -f1 -d$'\t' my.txt | sort > my_tags.txt comm -23 upstream_tags.txt my_tags.txt | grep -vE '^\s*$|^-$' > new_releases.txt echo "new_releases=$(paste -sd ',' new_releases.txt)" >> $GITHUB_OUTPUT echo "New releases to sync:" cat new_releases.txt || echo "(none)" + set -e - name: Sync new releases if: steps.find_new.outputs.new_releases != '' From 2e63d72af000d9de125ca9f5774515884da6a936 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Fri, 20 Jun 2025 13:08:02 +0800 Subject: [PATCH 09/23] Update release-sync.yml --- .github/workflows/release-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-sync.yml b/.github/workflows/release-sync.yml index 698e61f..39dd48b 100644 --- a/.github/workflows/release-sync.yml +++ b/.github/workflows/release-sync.yml @@ -1,4 +1,4 @@ -name: Sync Upstream Releases Only +name: Sync Releases on: schedule: From cba9cd1db93d00cd6bbbfe387c70702f9f641073 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:14:59 +0800 Subject: [PATCH 10/23] Create build.yml --- .github/workflows/build.yml | 288 ++++++++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..87276c6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,288 @@ +name: Build Application + +on: + push: + branches: [ main, master, develop ] + pull_request: + branches: [ main, master ] + workflow_dispatch: + +env: + PYTHON_VERSION: '3.12' + +jobs: + build-windows: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install system dependencies + run: | + # Install FFmpeg + choco install ffmpeg -y + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~\AppData\Local\pip\Cache + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + + - name: Create .env file + run: | + echo "PLATFORM=desktop" > .env + echo "HOST=127.0.0.1" >> .env + echo "PORT=6006" >> .env + + - name: Build Windows executable + run: | + pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.ico" --name "StreamCap" --add-data "assets;assets/" --add-data "config;config/" --add-data "locales;locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py + + - name: Create Windows installer + run: | + # Create a simple batch script for installation + echo '@echo off' > dist/StreamCap/install.bat + echo 'echo Installing StreamCap...' >> dist/StreamCap/install.bat + echo 'if not exist "%USERPROFILE%\StreamCap" mkdir "%USERPROFILE%\StreamCap"' >> dist/StreamCap/install.bat + echo 'xcopy /E /I /Y . "%USERPROFILE%\StreamCap"' >> dist/StreamCap/install.bat + echo 'echo Installation completed!' >> dist/StreamCap/install.bat + echo 'pause' >> dist/StreamCap/install.bat + + - name: Package Windows build + run: | + Compress-Archive -Path "dist/StreamCap/*" -DestinationPath "StreamCap-Windows.zip" + + - name: Upload Windows artifact + uses: actions/upload-artifact@v4 + with: + name: StreamCap-Windows + path: StreamCap-Windows.zip + retention-days: 30 + + build-macos: + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install system dependencies + run: | + # Install FFmpeg + brew install ffmpeg + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + pip install dmgbuild + + - name: Create .env file + run: | + echo "PLATFORM=desktop" > .env + echo "HOST=127.0.0.1" >> .env + echo "PORT=6006" >> .env + + - name: Build macOS executable + run: | + pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.ico" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py + + - name: Create macOS app bundle + run: | + mkdir -p "StreamCap.app/Contents/MacOS" + mkdir -p "StreamCap.app/Contents/Resources" + + # Create Info.plist + cat > "StreamCap.app/Contents/Info.plist" << EOF + + + + + CFBundleExecutable + StreamCap + CFBundleIdentifier + io.github.ihmily.streamcap + CFBundleName + StreamCap + CFBundleVersion + 1.0.1 + CFBundleShortVersionString + 1.0.1 + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleIconFile + icon + LSMinimumSystemVersion + 10.14 + NSHighResolutionCapable + + + + EOF + + # Copy executable and resources + cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" + cp assets/icon.ico "StreamCap.app/Contents/Resources/icon.ico" + + # Make executable + chmod +x "StreamCap.app/Contents/MacOS/StreamCap" + + - name: Create DMG settings file + run: | + cat > dmg_settings.py << EOF + import os + + # DMG settings + format = 'UDZO' + size = '500M' + files = ['StreamCap.app'] + symlinks = {'Applications': '/Applications'} + badge_icon = 'assets/icon.ico' + icon_locations = { + 'StreamCap.app': (150, 120), + 'Applications': (350, 120) + } + background = None + window_rect = ((100, 100), (500, 300)) + default_view = 'icon-view' + show_status_bar = False + show_tab_view = False + show_toolbar = False + show_pathbar = False + show_sidebar = False + sidebar_width = 180 + arrange_by = None + grid_offset = (0, 0) + grid_spacing = 100 + scroll_position = (0, 0) + label_pos = 'bottom' + text_size = 16 + icon_size = 128 + EOF + + - name: Create DMG + run: | + dmgbuild -s dmg_settings.py "StreamCap" "StreamCap-macOS.dmg" + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: StreamCap-macOS + path: StreamCap-macOS.dmg + retention-days: 30 + + build-linux: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y ffmpeg + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-web.txt + + - name: Create .env file + run: | + echo "PLATFORM=web" > .env + echo "HOST=0.0.0.0" >> .env + echo "PORT=6006" >> .env + + - name: Test web application + run: | + timeout 30s python main.py --web --host 0.0.0.0 --port 6006 || true + + - name: Package Linux build + run: | + # Create a clean directory for packaging + mkdir -p ../package + + # Copy files to package directory, excluding unwanted files + rsync -av --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' \ + --exclude='*.log' --exclude='.pytest_cache' --exclude='node_modules' \ + --exclude='dist' --exclude='build' --exclude='*.egg-info' \ + . ../package/StreamCap/ + + # Create tar from parent directory + cd ../package + tar -czf StreamCap-Linux.tar.gz StreamCap/ + + # Move back to workspace + mv StreamCap-Linux.tar.gz $GITHUB_WORKSPACE/ + + - name: Upload Linux artifact + uses: actions/upload-artifact@v4 + with: + name: StreamCap-Linux + path: StreamCap-Linux.tar.gz + retention-days: 30 + + build-summary: + needs: [build-windows, build-macos, build-linux] + runs-on: ubuntu-latest + if: always() + + steps: + - name: Build Summary + run: | + echo "## Build Summary" >> $GITHUB_STEP_SUMMARY + echo "| Platform | Status |" >> $GITHUB_STEP_SUMMARY + echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY + echo "| Windows | ${{ needs.build-windows.result }} |" >> $GITHUB_STEP_SUMMARY + echo "| macOS | ${{ needs.build-macos.result }} |" >> $GITHUB_STEP_SUMMARY + echo "| Linux | ${{ needs.build-linux.result }} |" >> $GITHUB_STEP_SUMMARY + + if [[ "${{ needs.build-windows.result }}" == "success" && "${{ needs.build-macos.result }}" == "success" && "${{ needs.build-linux.result }}" == "success" ]]; then + echo "✅ All builds completed successfully!" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Some builds failed. Please check the logs." >> $GITHUB_STEP_SUMMARY + fi From 57353c401c7f05cc8112544d939e0c7de59ecbe4 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:24:57 +0800 Subject: [PATCH 11/23] Update build.yml --- .github/workflows/build.yml | 131 +++++++++++------------------------- 1 file changed, 40 insertions(+), 91 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87276c6..30d2405 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Application +name: Build Prereleases on: push: @@ -13,11 +13,11 @@ env: jobs: build-windows: runs-on: windows-latest - + steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Set up Python uses: actions/setup-python@v4 with: @@ -25,7 +25,6 @@ jobs: - name: Install system dependencies run: | - # Install FFmpeg choco install ffmpeg -y - name: Cache pip dependencies @@ -54,7 +53,6 @@ jobs: - name: Create Windows installer run: | - # Create a simple batch script for installation echo '@echo off' > dist/StreamCap/install.bat echo 'echo Installing StreamCap...' >> dist/StreamCap/install.bat echo 'if not exist "%USERPROFILE%\StreamCap" mkdir "%USERPROFILE%\StreamCap"' >> dist/StreamCap/install.bat @@ -87,7 +85,6 @@ jobs: - name: Install system dependencies run: | - # Install FFmpeg brew install ffmpeg - name: Cache pip dependencies @@ -120,7 +117,6 @@ jobs: mkdir -p "StreamCap.app/Contents/MacOS" mkdir -p "StreamCap.app/Contents/Resources" - # Create Info.plist cat > "StreamCap.app/Contents/Info.plist" << EOF @@ -150,11 +146,8 @@ jobs: EOF - # Copy executable and resources cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" cp assets/icon.ico "StreamCap.app/Contents/Resources/icon.ico" - - # Make executable chmod +x "StreamCap.app/Contents/MacOS/StreamCap" - name: Create DMG settings file @@ -162,15 +155,13 @@ jobs: cat > dmg_settings.py << EOF import os - # DMG settings format = 'UDZO' size = '500M' files = ['StreamCap.app'] symlinks = {'Applications': '/Applications'} - badge_icon = 'assets/icon.ico' + badge_icon = 'assets/icon.ico' # Ensure the file exists icon_locations = { - 'StreamCap.app': (150, 120), - 'Applications': (350, 120) + 'StreamCap.app': (150, 120) # Adjusted for simplicity } background = None window_rect = ((100, 100), (500, 300)) @@ -201,88 +192,46 @@ jobs: path: StreamCap-macOS.dmg retention-days: 30 - build-linux: + prerelease: + needs: [ build-windows, build-macos ] + if: github.event_name != 'pull_request' && github.repository == 'lycorisdeve/streamcap' runs-on: ubuntu-latest - + env: + VERSION: ${{ needs.build-windows.outputs.version }} steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -y ffmpeg - - - name: Cache pip dependencies - uses: actions/cache@v3 + - uses: actions/checkout@v4 + + - name: Download Windows artifact + uses: actions/download-artifact@v4 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-web.txt - - - name: Create .env file - run: | - echo "PLATFORM=web" > .env - echo "HOST=0.0.0.0" >> .env - echo "PORT=6006" >> .env - - - name: Test web application + name: StreamCap-Windows + path: apk/ + + - name: Rename and prepare files run: | - timeout 30s python main.py --web --host 0.0.0.0 --port 6006 || true + mv apk/*.exe . + mv *.exe "StreamCap-Windows-${{ env.VERSION }}.exe" - - name: Package Linux build + - name: Delete Pre-Release (if exists) run: | - # Create a clean directory for packaging - mkdir -p ../package - - # Copy files to package directory, excluding unwanted files - rsync -av --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' \ - --exclude='*.log' --exclude='.pytest_cache' --exclude='node_modules' \ - --exclude='dist' --exclude='build' --exclude='*.egg-info' \ - . ../package/StreamCap/ - - # Create tar from parent directory - cd ../package - tar -czf StreamCap-Linux.tar.gz StreamCap/ - - # Move back to workspace - mv StreamCap-Linux.tar.gz $GITHUB_WORKSPACE/ - - - name: Upload Linux artifact - uses: actions/upload-artifact@v4 + if gh release view beta &>/dev/null; then + gh release delete beta -y + fi + env: + GH_TOKEN: ${{ github.token }} + + - name: Create or update beta tag + uses: richardsimko/update-tag@v1 with: - name: StreamCap-Linux - path: StreamCap-Linux.tar.gz - retention-days: 30 + tag_name: beta + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - build-summary: - needs: [build-windows, build-macos, build-linux] - runs-on: ubuntu-latest - if: always() - - steps: - - name: Build Summary - run: | - echo "## Build Summary" >> $GITHUB_STEP_SUMMARY - echo "| Platform | Status |" >> $GITHUB_STEP_SUMMARY - echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY - echo "| Windows | ${{ needs.build-windows.result }} |" >> $GITHUB_STEP_SUMMARY - echo "| macOS | ${{ needs.build-macos.result }} |" >> $GITHUB_STEP_SUMMARY - echo "| Linux | ${{ needs.build-linux.result }} |" >> $GITHUB_STEP_SUMMARY - - if [[ "${{ needs.build-windows.result }}" == "success" && "${{ needs.build-macos.result }}" == "success" && "${{ needs.build-linux.result }}" == "success" ]]; then - echo "✅ All builds completed successfully!" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Some builds failed. Please check the logs." >> $GITHUB_STEP_SUMMARY - fi + - name: Publish Pre-Release + uses: ncipollo/release-action@v1 + with: + name: StreamCap-${{ env.VERSION }} + tag: "beta" + body: "此版本为测试版,签名与正式版不同,可能存在不稳定情况,升级前请务必备份好数据。" + prerelease: true + artifacts: ${{ github.workspace }}/*.exe From 72c03a872a4e48e333b0262642ca3ada3247bd4a Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:33:31 +0800 Subject: [PATCH 12/23] Update build.yml --- .github/workflows/build.yml | 258 +++++++++++++++++++++++------------- 1 file changed, 168 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30d2405..1cb2424 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Prereleases +name: Build Application on: push: @@ -70,9 +70,137 @@ jobs: name: StreamCap-Windows path: StreamCap-Windows.zip retention-days: 30 + build-macos: + runs-on: macos-latest - build-macos: - runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install system dependencies + run: | + brew install ffmpeg + # 安装 iconutil 工具 + brew install iconutil + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + pip install dmgbuild + + - name: Create .env file + run: | + echo "PLATFORM=desktop" > .env + echo "HOST=127.0.0.1" >> .env + echo "PORT=6006" >> .env + + - name: Convert .ico to .icns + run: | + # 假设你有一个 icon.png 文件 + iconutil -c icns assets/icon.png + + - name: Build macOS executable + run: | + pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.icns" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py + + - name: Create macOS app bundle + run: | + mkdir -p "StreamCap.app/Contents/MacOS" + mkdir -p "StreamCap.app/Contents/Resources" + + cat > "StreamCap.app/Contents/Info.plist" << EOF + + + + + CFBundleExecutable + StreamCap + CFBundleIdentifier + io.github.ihmily.streamcap + CFBundleName + StreamCap + CFBundleVersion + 1.0.1 + CFBundleShortVersionString + 1.0.1 + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleIconFile + icon + LSMinimumSystemVersion + 10.14 + NSHighResolutionCapable + + + + EOF + + cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" + cp assets/icon.icns "StreamCap.app/Contents/Resources/icon.icns" + chmod +x "StreamCap.app/Contents/MacOS/StreamCap" + + - name: Create DMG settings file + run: | + cat > dmg_settings.py << EOF + import os + + # DMG settings + format = 'UDZO' + size = '500M' + files = ['StreamCap.app'] + symlinks = {'Applications': '/Applications'} + badge_icon = 'assets/icon.icns' # Ensure the file exists + icon_locations = { + 'StreamCap.app': (150, 120) + } + background = None + window_rect = ((100, 100), (500, 300)) + default_view = 'icon-view' + show_status_bar = False + show_tab_view = False + show_toolbar = False + show_pathbar = False + show_sidebar = False + sidebar_width = 180 + arrange_by = None + grid_offset = (0, 0) + grid_spacing = 100 + scroll_position = (0, 0) + label_pos = 'bottom' + text_size = 16 + icon_size = 128 + EOF + + - name: Create DMG + run: | + dmgbuild -s dmg_settings.py "StreamCap" "StreamCap-macOS.dmg" + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: StreamCap-macOS + path: StreamCap-macOS.dmg + retention-days: 30 + + build-linux: + runs-on: ubuntu-latest steps: - name: Checkout code @@ -85,12 +213,13 @@ jobs: - name: Install system dependencies run: | - brew install ffmpeg + sudo apt-get update + sudo apt-get install -y ffmpeg - name: Cache pip dependencies uses: actions/cache@v3 with: - path: ~/Library/Caches/pip + path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- @@ -98,102 +227,35 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pyinstaller - pip install dmgbuild + pip install -r requirements-web.txt - name: Create .env file run: | - echo "PLATFORM=desktop" > .env - echo "HOST=127.0.0.1" >> .env + echo "PLATFORM=web" > .env + echo "HOST=0.0.0.0" >> .env echo "PORT=6006" >> .env - - name: Build macOS executable + - name: Test web application run: | - pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.ico" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py + timeout 30s python main.py --web --host 0.0.0.0 --port 6006 || true - - name: Create macOS app bundle + - name: Package Linux build run: | - mkdir -p "StreamCap.app/Contents/MacOS" - mkdir -p "StreamCap.app/Contents/Resources" + mkdir -p ../package + rsync -av --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' --exclude='*.log' --exclude='.pytest_cache' --exclude='node_modules' --exclude='dist' --exclude='build' --exclude='*.egg-info' . ../package/StreamCap/ + cd ../package + tar -czf StreamCap-Linux.tar.gz StreamCap/ + mv StreamCap-Linux.tar.gz $GITHUB_WORKSPACE/ - cat > "StreamCap.app/Contents/Info.plist" << EOF - - - - - CFBundleExecutable - StreamCap - CFBundleIdentifier - io.github.ihmily.streamcap - CFBundleName - StreamCap - CFBundleVersion - 1.0.1 - CFBundleShortVersionString - 1.0.1 - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleIconFile - icon - LSMinimumSystemVersion - 10.14 - NSHighResolutionCapable - - - - EOF - - cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" - cp assets/icon.ico "StreamCap.app/Contents/Resources/icon.ico" - chmod +x "StreamCap.app/Contents/MacOS/StreamCap" - - - name: Create DMG settings file - run: | - cat > dmg_settings.py << EOF - import os - - format = 'UDZO' - size = '500M' - files = ['StreamCap.app'] - symlinks = {'Applications': '/Applications'} - badge_icon = 'assets/icon.ico' # Ensure the file exists - icon_locations = { - 'StreamCap.app': (150, 120) # Adjusted for simplicity - } - background = None - window_rect = ((100, 100), (500, 300)) - default_view = 'icon-view' - show_status_bar = False - show_tab_view = False - show_toolbar = False - show_pathbar = False - show_sidebar = False - sidebar_width = 180 - arrange_by = None - grid_offset = (0, 0) - grid_spacing = 100 - scroll_position = (0, 0) - label_pos = 'bottom' - text_size = 16 - icon_size = 128 - EOF - - - name: Create DMG - run: | - dmgbuild -s dmg_settings.py "StreamCap" "StreamCap-macOS.dmg" - - - name: Upload macOS artifact + - name: Upload Linux artifact uses: actions/upload-artifact@v4 with: - name: StreamCap-macOS - path: StreamCap-macOS.dmg + name: StreamCap-Linux + path: StreamCap-Linux.tar.gz retention-days: 30 prerelease: - needs: [ build-windows, build-macos ] + needs: [ build-windows, build-macos, build-linux ] if: github.event_name != 'pull_request' && github.repository == 'lycorisdeve/streamcap' runs-on: ubuntu-latest env: @@ -205,12 +267,28 @@ jobs: uses: actions/download-artifact@v4 with: name: StreamCap-Windows - path: apk/ + path: releases/ + + - name: Download macOS artifact + uses: actions/download-artifact@v4 + with: + name: StreamCap-macOS + path: releases/ + + - name: Download Linux artifact + uses: actions/download-artifact@v4 + with: + name: StreamCap-Linux + path: releases/ - name: Rename and prepare files run: | - mv apk/*.exe . + mv releases/*.exe . + mv releases/*.dmg . + mv releases/*.tar.gz . mv *.exe "StreamCap-Windows-${{ env.VERSION }}.exe" + mv *.dmg "StreamCap-macOS-${{ env.VERSION }}.dmg" + mv *.tar.gz "StreamCap-Linux-${{ env.VERSION }}.tar.gz" - name: Delete Pre-Release (if exists) run: | @@ -234,4 +312,4 @@ jobs: tag: "beta" body: "此版本为测试版,签名与正式版不同,可能存在不稳定情况,升级前请务必备份好数据。" prerelease: true - artifacts: ${{ github.workspace }}/*.exe + artifacts: ${{ github.workspace }}/*.exe,${{ github.workspace }}/*.dmg,${{ github.workspace }}/*.tar.gz From 52583f0e68f817be87a4f425fda7ebe69430b466 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 13:28:49 +0800 Subject: [PATCH 13/23] Update build.yml --- .github/workflows/build.yml | 235 ++++++++++++++++++------------------ 1 file changed, 118 insertions(+), 117 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cb2424..51cacdd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,134 +70,135 @@ jobs: name: StreamCap-Windows path: StreamCap-Windows.zip retention-days: 30 - build-macos: - runs-on: macos-latest + + build-macos: + runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + steps: + - name: Checkout code + uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} - - name: Install system dependencies - run: | - brew install ffmpeg - # 安装 iconutil 工具 - brew install iconutil + - name: Install system dependencies + run: | + brew install ffmpeg + # 安装 iconutil 工具 + brew install iconutil - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~/Library/Caches/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pyinstaller - pip install dmgbuild + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + pip install dmgbuild - - name: Create .env file - run: | - echo "PLATFORM=desktop" > .env - echo "HOST=127.0.0.1" >> .env - echo "PORT=6006" >> .env + - name: Create .env file + run: | + echo "PLATFORM=desktop" > .env + echo "HOST=127.0.0.1" >> .env + echo "PORT=6006" >> .env - - name: Convert .ico to .icns - run: | - # 假设你有一个 icon.png 文件 - iconutil -c icns assets/icon.png + - name: Convert .ico to .icns + run: | + # 假设你有一个 icon.png 文件 + iconutil -c icns assets/icon.png - - name: Build macOS executable - run: | - pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.icns" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py + - name: Build macOS executable + run: | + pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.icns" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py - - name: Create macOS app bundle - run: | - mkdir -p "StreamCap.app/Contents/MacOS" - mkdir -p "StreamCap.app/Contents/Resources" - - cat > "StreamCap.app/Contents/Info.plist" << EOF - - - - - CFBundleExecutable - StreamCap - CFBundleIdentifier - io.github.ihmily.streamcap - CFBundleName - StreamCap - CFBundleVersion - 1.0.1 - CFBundleShortVersionString - 1.0.1 - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleIconFile - icon - LSMinimumSystemVersion - 10.14 - NSHighResolutionCapable - - - - EOF - - cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" - cp assets/icon.icns "StreamCap.app/Contents/Resources/icon.icns" - chmod +x "StreamCap.app/Contents/MacOS/StreamCap" - - - name: Create DMG settings file - run: | - cat > dmg_settings.py << EOF - import os + - name: Create macOS app bundle + run: | + mkdir -p "StreamCap.app/Contents/MacOS" + mkdir -p "StreamCap.app/Contents/Resources" + + cat > "StreamCap.app/Contents/Info.plist" << EOF + + + + + CFBundleExecutable + StreamCap + CFBundleIdentifier + io.github.ihmily.streamcap + CFBundleName + StreamCap + CFBundleVersion + 1.0.1 + CFBundleShortVersionString + 1.0.1 + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleIconFile + icon + LSMinimumSystemVersion + 10.14 + NSHighResolutionCapable + + + + EOF + + cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" + cp assets/icon.icns "StreamCap.app/Contents/Resources/icon.icns" + chmod +x "StreamCap.app/Contents/MacOS/StreamCap" + + - name: Create DMG settings file + run: | + cat > dmg_settings.py << EOF + import os - # DMG settings - format = 'UDZO' - size = '500M' - files = ['StreamCap.app'] - symlinks = {'Applications': '/Applications'} - badge_icon = 'assets/icon.icns' # Ensure the file exists - icon_locations = { - 'StreamCap.app': (150, 120) - } - background = None - window_rect = ((100, 100), (500, 300)) - default_view = 'icon-view' - show_status_bar = False - show_tab_view = False - show_toolbar = False - show_pathbar = False - show_sidebar = False - sidebar_width = 180 - arrange_by = None - grid_offset = (0, 0) - grid_spacing = 100 - scroll_position = (0, 0) - label_pos = 'bottom' - text_size = 16 - icon_size = 128 - EOF + # DMG settings + format = 'UDZO' + size = '500M' + files = ['StreamCap.app'] + symlinks = {'Applications': '/Applications'} + badge_icon = 'assets/icon.icns' # Ensure the file exists + icon_locations = { + 'StreamCap.app': (150, 120) + } + background = None + window_rect = ((100, 100), (500, 300)) + default_view = 'icon-view' + show_status_bar = False + show_tab_view = False + show_toolbar = False + show_pathbar = False + show_sidebar = False + sidebar_width = 180 + arrange_by = None + grid_offset = (0, 0) + grid_spacing = 100 + scroll_position = (0, 0) + label_pos = 'bottom' + text_size = 16 + icon_size = 128 + EOF - - name: Create DMG - run: | - dmgbuild -s dmg_settings.py "StreamCap" "StreamCap-macOS.dmg" - - - name: Upload macOS artifact - uses: actions/upload-artifact@v4 - with: - name: StreamCap-macOS - path: StreamCap-macOS.dmg - retention-days: 30 + - name: Create DMG + run: | + dmgbuild -s dmg_settings.py "StreamCap" "StreamCap-macOS.dmg" + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: StreamCap-macOS + path: StreamCap-macOS.dmg + retention-days: 30 build-linux: runs-on: ubuntu-latest From 67369c906a2c8888eb5a3bd4f3a088d211e69178 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 13:32:33 +0800 Subject: [PATCH 14/23] Update build.yml --- .github/workflows/build.yml | 117 ++++++++++-------------------------- 1 file changed, 31 insertions(+), 86 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51cacdd..8a5c68b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,19 +70,19 @@ jobs: name: StreamCap-Windows path: StreamCap-Windows.zip retention-days: 30 - + build-macos: runs-on: macos-latest - + steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - + - name: Install system dependencies run: | brew install ffmpeg @@ -96,14 +96,14 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - + - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pyinstaller pip install dmgbuild - + - name: Create .env file run: | echo "PLATFORM=desktop" > .env @@ -118,45 +118,45 @@ jobs: - name: Build macOS executable run: | pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.icns" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py - + - name: Create macOS app bundle run: | mkdir -p "StreamCap.app/Contents/MacOS" mkdir -p "StreamCap.app/Contents/Resources" - + cat > "StreamCap.app/Contents/Info.plist" << EOF - CFBundleExecutable - StreamCap - CFBundleIdentifier - io.github.ihmily.streamcap - CFBundleName - StreamCap - CFBundleVersion - 1.0.1 - CFBundleShortVersionString - 1.0.1 - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleIconFile - icon - LSMinimumSystemVersion - 10.14 - NSHighResolutionCapable - + CFBundleExecutable + StreamCap + CFBundleIdentifier + io.github.ihmily.streamcap + CFBundleName + StreamCap + CFBundleVersion + 1.0.1 + CFBundleShortVersionString + 1.0.1 + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleIconFile + icon + LSMinimumSystemVersion + 10.14 + NSHighResolutionCapable + EOF - + cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" cp assets/icon.icns "StreamCap.app/Contents/Resources/icon.icns" chmod +x "StreamCap.app/Contents/MacOS/StreamCap" - + - name: Create DMG settings file run: | cat > dmg_settings.py << EOF @@ -169,7 +169,7 @@ jobs: symlinks = {'Applications': '/Applications'} badge_icon = 'assets/icon.icns' # Ensure the file exists icon_locations = { - 'StreamCap.app': (150, 120) + 'StreamCap.app': (150, 120) } background = None window_rect = ((100, 100), (500, 300)) @@ -200,61 +200,6 @@ jobs: path: StreamCap-macOS.dmg retention-days: 30 - build-linux: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -y ffmpeg - - - name: Cache pip dependencies - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-web.txt - - - name: Create .env file - run: | - echo "PLATFORM=web" > .env - echo "HOST=0.0.0.0" >> .env - echo "PORT=6006" >> .env - - - name: Test web application - run: | - timeout 30s python main.py --web --host 0.0.0.0 --port 6006 || true - - - name: Package Linux build - run: | - mkdir -p ../package - rsync -av --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' --exclude='*.log' --exclude='.pytest_cache' --exclude='node_modules' --exclude='dist' --exclude='build' --exclude='*.egg-info' . ../package/StreamCap/ - cd ../package - tar -czf StreamCap-Linux.tar.gz StreamCap/ - mv StreamCap-Linux.tar.gz $GITHUB_WORKSPACE/ - - - name: Upload Linux artifact - uses: actions/upload-artifact@v4 - with: - name: StreamCap-Linux - path: StreamCap-Linux.tar.gz - retention-days: 30 - prerelease: needs: [ build-windows, build-macos, build-linux ] if: github.event_name != 'pull_request' && github.repository == 'lycorisdeve/streamcap' From e591b40449ffa37eba577a5d30d08c0f5727e40e Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 13:34:51 +0800 Subject: [PATCH 15/23] Update build.yml --- .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a5c68b..5becb55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -200,6 +200,65 @@ jobs: path: StreamCap-macOS.dmg retention-days: 30 + build-linux: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y ffmpeg + + - name: Cache pip dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-web.txt + + - name: Create .env file + run: | + echo "PLATFORM=web" > .env + echo "HOST=0.0.0.0" >> .env + echo "PORT=6006" >> .env + + - name: Test web application + run: | + timeout 30s python main.py --web --host 0.0.0.0 --port 6006 || true + + - name: Package Linux build + run: | + mkdir -p ../package + rsync -av --exclude='.git' --exclude='__pycache__' --exclude='*.pyc' --exclude='*.log' --exclude='.pytest_cache' --exclude='node_modules' --exclude='dist' --exclude='build' --exclude='*.egg-info' . ../package/StreamCap/ + cd ../package + tar -czf StreamCap-Linux.tar.gz StreamCap/ + mv StreamCap-Linux.tar.gz $GITHUB_WORKSPACE/ + + - name: Upload Linux artifact + uses: actions/upload-artifact@v4 + with: + name: StreamCap-Linux + path: StreamCap-Linux.tar.gz + retention-days: 30 + + # 这里提供一个输出 + outputs: + linux-artifact-path: ${{ steps.upload-linux-artifact.outputs.artifact-path }} + prerelease: needs: [ build-windows, build-macos, build-linux ] if: github.event_name != 'pull_request' && github.repository == 'lycorisdeve/streamcap' From 82c72a321129121fd61dcac1fb944a3ff58f0ffb Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 13:47:58 +0800 Subject: [PATCH 16/23] Update build.yml --- .github/workflows/build.yml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5becb55..f9e8369 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,10 +85,9 @@ jobs: - name: Install system dependencies run: | + # Install FFmpeg brew install ffmpeg - # 安装 iconutil 工具 - brew install iconutil - + - name: Cache pip dependencies uses: actions/cache@v3 with: @@ -109,21 +108,17 @@ jobs: echo "PLATFORM=desktop" > .env echo "HOST=127.0.0.1" >> .env echo "PORT=6006" >> .env - - - name: Convert .ico to .icns - run: | - # 假设你有一个 icon.png 文件 - iconutil -c icns assets/icon.png - + - name: Build macOS executable run: | - pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.icns" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py + pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.ico" --name "StreamCap" --add-data "assets:assets/" --add-data "config:config/" --add-data "locales:locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py - name: Create macOS app bundle run: | mkdir -p "StreamCap.app/Contents/MacOS" mkdir -p "StreamCap.app/Contents/Resources" + # Create Info.plist cat > "StreamCap.app/Contents/Info.plist" << EOF @@ -153,23 +148,27 @@ jobs: EOF + # Copy executable and resources cp -r dist/StreamCap/* "StreamCap.app/Contents/MacOS/" - cp assets/icon.icns "StreamCap.app/Contents/Resources/icon.icns" + cp assets/icon.ico "StreamCap.app/Contents/Resources/icon.ico" + + # Make executable chmod +x "StreamCap.app/Contents/MacOS/StreamCap" - name: Create DMG settings file run: | cat > dmg_settings.py << EOF import os - + # DMG settings format = 'UDZO' size = '500M' files = ['StreamCap.app'] symlinks = {'Applications': '/Applications'} - badge_icon = 'assets/icon.icns' # Ensure the file exists + badge_icon = 'assets/icons/Appicon.icns' icon_locations = { - 'StreamCap.app': (150, 120) + 'StreamCap.app': (150, 120), + 'Applications': (350, 120) } background = None window_rect = ((100, 100), (500, 300)) @@ -188,11 +187,11 @@ jobs: text_size = 16 icon_size = 128 EOF - + - name: Create DMG run: | dmgbuild -s dmg_settings.py "StreamCap" "StreamCap-macOS.dmg" - + - name: Upload macOS artifact uses: actions/upload-artifact@v4 with: From d8905a0f2602495cfdd4b7db1bd81ffd187e1386 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:12:02 +0800 Subject: [PATCH 17/23] Update build.yml --- .github/workflows/build.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9e8369..651c831 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -287,12 +287,9 @@ jobs: - name: Rename and prepare files run: | - mv releases/*.exe . - mv releases/*.dmg . - mv releases/*.tar.gz . - mv *.exe "StreamCap-Windows-${{ env.VERSION }}.exe" - mv *.dmg "StreamCap-macOS-${{ env.VERSION }}.dmg" - mv *.tar.gz "StreamCap-Linux-${{ env.VERSION }}.tar.gz" + mv releases/StreamCap-Windows.zip "StreamCap-Windows-${{ env.VERSION }}.zip" + mv releases/StreamCap-macOS.zip "StreamCap-macOS-${{ env.VERSION }}.zip" + mv releases/StreamCap-Linux.zip "StreamCap-Linux-${{ env.VERSION }}.zip" - name: Delete Pre-Release (if exists) run: | @@ -316,4 +313,4 @@ jobs: tag: "beta" body: "此版本为测试版,签名与正式版不同,可能存在不稳定情况,升级前请务必备份好数据。" prerelease: true - artifacts: ${{ github.workspace }}/*.exe,${{ github.workspace }}/*.dmg,${{ github.workspace }}/*.tar.gz + artifacts: ${{ github.workspace }}/*.zip From 1bc0e2419a2124dbe0efeeb233454dce7476aad4 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:45:08 +0800 Subject: [PATCH 18/23] Update build.yml --- .github/workflows/build.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 651c831..d544ec7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -285,11 +285,28 @@ jobs: name: StreamCap-Linux path: releases/ - - name: Rename and prepare files + - name: Check and rename files run: | - mv releases/StreamCap-Windows.zip "StreamCap-Windows-${{ env.VERSION }}.zip" - mv releases/StreamCap-macOS.zip "StreamCap-macOS-${{ env.VERSION }}.zip" - mv releases/StreamCap-Linux.zip "StreamCap-Linux-${{ env.VERSION }}.zip" + # 检查 Windows 文件是否存在并重命名 + if [ -f "releases/StreamCap-Windows.zip" ]; then + mv releases/StreamCap-Windows.zip "StreamCap-Windows-${{ env.VERSION }}.zip" + else + echo "StreamCap-Windows.zip not found!" + fi + + # 检查 macOS 文件是否存在并重命名 + if [ -f "releases/StreamCap-macOS.zip" ]; then + mv releases/StreamCap-macOS.zip "StreamCap-macOS-${{ env.VERSION }}.zip" + else + echo "StreamCap-macOS.zip not found!" + fi + + # 检查 Linux 文件是否存在并重命名 + if [ -f "releases/StreamCap-Linux.zip" ]; then + mv releases/StreamCap-Linux.zip "StreamCap-Linux-${{ env.VERSION }}.zip" + else + echo "StreamCap-Linux.zip not found!" + fi - name: Delete Pre-Release (if exists) run: | From 6f8a15889fe52908eceb9ef95628b4acbe9ad308 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:18:14 +0800 Subject: [PATCH 19/23] Update build.yml --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d544ec7..61e238e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -284,7 +284,8 @@ jobs: with: name: StreamCap-Linux path: releases/ - + - name: List downloaded files + run: ls -l releases/ - name: Check and rename files run: | # 检查 Windows 文件是否存在并重命名 From 3f885c839b2774edbc92a78317224fd7e3b1e2d6 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:35:25 +0800 Subject: [PATCH 20/23] Update build.yml --- .github/workflows/build.yml | 39 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61e238e..c6b17f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -284,30 +284,29 @@ jobs: with: name: StreamCap-Linux path: releases/ - - name: List downloaded files - run: ls -l releases/ + - name: Check and rename files run: | # 检查 Windows 文件是否存在并重命名 if [ -f "releases/StreamCap-Windows.zip" ]; then - mv releases/StreamCap-Windows.zip "StreamCap-Windows-${{ env.VERSION }}.zip" - else - echo "StreamCap-Windows.zip not found!" - fi + mv releases/StreamCap-Windows.zip "StreamCap_Windows_beta.zip" + else + echo "StreamCap-Windows.zip not found!" + fi - # 检查 macOS 文件是否存在并重命名 - if [ -f "releases/StreamCap-macOS.zip" ]; then - mv releases/StreamCap-macOS.zip "StreamCap-macOS-${{ env.VERSION }}.zip" - else - echo "StreamCap-macOS.zip not found!" - fi + # 检查 macOS 文件是否存在并重命名 + if [ -f "releases/StreamCap-macOS.dmg" ]; then + mv releases/StreamCap-macOS.dmg "StreamCap_macOS_beta.dmg" + else + echo "StreamCap-macOS.dmg not found!" + fi - # 检查 Linux 文件是否存在并重命名 - if [ -f "releases/StreamCap-Linux.zip" ]; then - mv releases/StreamCap-Linux.zip "StreamCap-Linux-${{ env.VERSION }}.zip" - else - echo "StreamCap-Linux.zip not found!" - fi + # 检查 Linux 文件是否存在并重命名 + if [ -f "releases/StreamCap-Linux.tar.gz" ]; then + mv releases/StreamCap-Linux.tar.gz "StreamCap_Linux_beta.tar.gz" + else + echo "StreamCap-Linux.tar.gz not found!" + fi - name: Delete Pre-Release (if exists) run: | @@ -327,8 +326,8 @@ jobs: - name: Publish Pre-Release uses: ncipollo/release-action@v1 with: - name: StreamCap-${{ env.VERSION }} + name: StreamCap-beta tag: "beta" - body: "此版本为测试版,签名与正式版不同,可能存在不稳定情况,升级前请务必备份好数据。" + body: "此版本为测试版,可能存在不稳定情况,升级前请务必备份好数据。" prerelease: true artifacts: ${{ github.workspace }}/*.zip From 89687d2360c115c92f8f22f79d8deaeacdc5ff68 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:40:48 +0800 Subject: [PATCH 21/23] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6b17f0..1f26544 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -330,4 +330,4 @@ jobs: tag: "beta" body: "此版本为测试版,可能存在不稳定情况,升级前请务必备份好数据。" prerelease: true - artifacts: ${{ github.workspace }}/*.zip + artifacts: ${{ github.workspace }}/*.zip,${{ github.workspace }}/*.dmg,${{ github.workspace }}/*.tar.gz From b0acfb2097e61cd98dc10f30daa6823d7c912d2b Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 16:25:59 +0800 Subject: [PATCH 22/23] Update build.yml --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f26544..9f31e5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,15 +53,37 @@ jobs: - name: Create Windows installer run: | - echo '@echo off' > dist/StreamCap/install.bat - echo 'echo Installing StreamCap...' >> dist/StreamCap/install.bat - echo 'if not exist "%USERPROFILE%\StreamCap" mkdir "%USERPROFILE%\StreamCap"' >> dist/StreamCap/install.bat - echo 'xcopy /E /I /Y . "%USERPROFILE%\StreamCap"' >> dist/StreamCap/install.bat - echo 'echo Installation completed!' >> dist/StreamCap/install.bat - echo 'pause' >> dist/StreamCap/install.bat + echo @echo off > dist/StreamCap/install.bat + echo chcp 65001 >> dist/StreamCap/install.bat + echo set SCRIPT_DIR=%~dp0 >> dist/StreamCap/install.bat + echo echo Moving folders from _internal... >> dist/StreamCap/install.bat + echo rem Move folders, overwrite if they already exist >> dist/StreamCap/install.bat + echo if exist "%SCRIPT_DIR%\_internal\config" ( >> dist/StreamCap/install.bat + echo echo Moving config folder... >> dist/StreamCap/install.bat + echo rmdir /s /q "%SCRIPT_DIR%\config" >nul 2>&1 >> dist/StreamCap/install.bat + echo move "%SCRIPT_DIR%\_internal\config" "%SCRIPT_DIR%" >> dist/StreamCap/install.bat + echo ) >> dist/StreamCap/install.bat + echo echo 安装完成...............................百分之30 >> dist/StreamCap/install.bat + echo if exist "%SCRIPT_DIR%\_internal\locales" ( >> dist/StreamCap/install.bat + echo echo Moving locales folder... >> dist/StreamCap/install.bat + echo rmdir /s /q "%SCRIPT_DIR%\locales" >nul 2>&1 >> dist/StreamCap/install.bat + echo move "%SCRIPT_DIR%\_internal\locales" "%SCRIPT_DIR%" >> dist/StreamCap/install.bat + echo ) >> dist/StreamCap/install.bat + echo echo 安装完成...............................百分之60 >> dist/StreamCap/install.bat + echo if exist "%SCRIPT_DIR%\_internal\assets" ( >> dist/StreamCap/install.bat + echo echo Moving assets folder... >> dist/StreamCap/install.bat + echo rmdir /s /q "%SCRIPT_DIR%\assets" >nul 2>&1 >> dist/StreamCap/install.bat + echo move "%SCRIPT_DIR%\_internal\assets" "%SCRIPT_DIR%" >> dist/StreamCap/install.bat + echo ) >> dist/StreamCap/install.bat + echo echo 安装完成!请运行.exe文件开始使用 >> dist/StreamCap/install.bat + echo pause >> dist/StreamCap/install.bat - name: Package Windows build run: | + mv dist/StreamCap/_internal/config dist/StreamCap/ + mv dist/StreamCap/_internal/locales dist/StreamCap/ + mv dist/StreamCap/_internal/assets dist/StreamCap/ + echo "Folders moved successfully." Compress-Archive -Path "dist/StreamCap/*" -DestinationPath "StreamCap-Windows.zip" - name: Upload Windows artifact From 61884d3035d701ba7fce51d21e47e51e87740087 Mon Sep 17 00:00:00 2001 From: Lycoris <93499735+lycorisdeve@users.noreply.github.com> Date: Tue, 29 Jul 2025 16:30:48 +0800 Subject: [PATCH 23/23] Update build.yml --- .github/workflows/build.yml | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f31e5f..2b1dc71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,39 +51,15 @@ jobs: run: | pyinstaller --noconfirm --onedir --windowed --icon "assets/icon.ico" --name "StreamCap" --add-data "assets;assets/" --add-data "config;config/" --add-data "locales;locales/" --hidden-import "flet.matplotlib_chart" --hidden-import "flet.plotly_chart" --hidden-import "flet.video" --collect-all "streamget" main.py - - name: Create Windows installer - run: | - echo @echo off > dist/StreamCap/install.bat - echo chcp 65001 >> dist/StreamCap/install.bat - echo set SCRIPT_DIR=%~dp0 >> dist/StreamCap/install.bat - echo echo Moving folders from _internal... >> dist/StreamCap/install.bat - echo rem Move folders, overwrite if they already exist >> dist/StreamCap/install.bat - echo if exist "%SCRIPT_DIR%\_internal\config" ( >> dist/StreamCap/install.bat - echo echo Moving config folder... >> dist/StreamCap/install.bat - echo rmdir /s /q "%SCRIPT_DIR%\config" >nul 2>&1 >> dist/StreamCap/install.bat - echo move "%SCRIPT_DIR%\_internal\config" "%SCRIPT_DIR%" >> dist/StreamCap/install.bat - echo ) >> dist/StreamCap/install.bat - echo echo 安装完成...............................百分之30 >> dist/StreamCap/install.bat - echo if exist "%SCRIPT_DIR%\_internal\locales" ( >> dist/StreamCap/install.bat - echo echo Moving locales folder... >> dist/StreamCap/install.bat - echo rmdir /s /q "%SCRIPT_DIR%\locales" >nul 2>&1 >> dist/StreamCap/install.bat - echo move "%SCRIPT_DIR%\_internal\locales" "%SCRIPT_DIR%" >> dist/StreamCap/install.bat - echo ) >> dist/StreamCap/install.bat - echo echo 安装完成...............................百分之60 >> dist/StreamCap/install.bat - echo if exist "%SCRIPT_DIR%\_internal\assets" ( >> dist/StreamCap/install.bat - echo echo Moving assets folder... >> dist/StreamCap/install.bat - echo rmdir /s /q "%SCRIPT_DIR%\assets" >nul 2>&1 >> dist/StreamCap/install.bat - echo move "%SCRIPT_DIR%\_internal\assets" "%SCRIPT_DIR%" >> dist/StreamCap/install.bat - echo ) >> dist/StreamCap/install.bat - echo echo 安装完成!请运行.exe文件开始使用 >> dist/StreamCap/install.bat - echo pause >> dist/StreamCap/install.bat - - - name: Package Windows build + - name: Fix Windows pkg run: | mv dist/StreamCap/_internal/config dist/StreamCap/ mv dist/StreamCap/_internal/locales dist/StreamCap/ mv dist/StreamCap/_internal/assets dist/StreamCap/ echo "Folders moved successfully." + + - name: Package Windows build + run: | Compress-Archive -Path "dist/StreamCap/*" -DestinationPath "StreamCap-Windows.zip" - name: Upload Windows artifact