refactor: split Windows and macOS into separate jobs
Release is created if at least one platform succeeds, so a failure on one doesn't block the other. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,25 +3,16 @@ name: Build & Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*" # trigger on version tags like v1.0.0
|
- "v*"
|
||||||
workflow_dispatch: # allow manual trigger
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # needed to create releases
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
# ── Windows ────────────────────────────────────────────────
|
||||||
strategy:
|
windows:
|
||||||
fail-fast: false
|
runs-on: windows-latest
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: windows-latest
|
|
||||||
artifact: 8cut-windows
|
|
||||||
- os: macos-latest # Apple Silicon
|
|
||||||
artifact: 8cut-macos-arm64
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -29,17 +20,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
|
|
||||||
# ── Install Python deps ──────────────────────────────────
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: |
|
run: pip install pyinstaller PyQt6 python-mpv
|
||||||
pip install pyinstaller PyQt6 python-mpv
|
|
||||||
|
|
||||||
# ── Windows: fetch ffmpeg + libmpv ───────────────────────
|
- name: Fetch ffmpeg
|
||||||
- name: Fetch ffmpeg (Windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
# ffmpeg static build
|
|
||||||
$ffUrl = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
|
$ffUrl = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
|
||||||
Invoke-WebRequest $ffUrl -OutFile ffmpeg.zip
|
Invoke-WebRequest $ffUrl -OutFile ffmpeg.zip
|
||||||
Expand-Archive ffmpeg.zip -DestinationPath ffmpeg-tmp
|
Expand-Archive ffmpeg.zip -DestinationPath ffmpeg-tmp
|
||||||
@@ -47,13 +33,10 @@ jobs:
|
|||||||
Copy-Item "$($bin.DirectoryName)\ffmpeg.exe" .
|
Copy-Item "$($bin.DirectoryName)\ffmpeg.exe" .
|
||||||
Copy-Item "$($bin.DirectoryName)\ffprobe.exe" .
|
Copy-Item "$($bin.DirectoryName)\ffprobe.exe" .
|
||||||
|
|
||||||
- name: Fetch libmpv (Windows)
|
- name: Fetch libmpv
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
# shinchiro libmpv dev build
|
|
||||||
$mpvUrl = "https://github.com/shinchiro/mpv-winbuild-cmake/releases/latest"
|
$mpvUrl = "https://github.com/shinchiro/mpv-winbuild-cmake/releases/latest"
|
||||||
# Get redirect URL to find latest tag
|
|
||||||
$release = Invoke-WebRequest $mpvUrl -MaximumRedirection 0 -ErrorAction SilentlyContinue
|
$release = Invoke-WebRequest $mpvUrl -MaximumRedirection 0 -ErrorAction SilentlyContinue
|
||||||
$tag = ($release.Headers.Location -split '/')[-1]
|
$tag = ($release.Headers.Location -split '/')[-1]
|
||||||
$dlUrl = "https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/$tag/mpv-dev-x86_64-v3-${tag}.7z"
|
$dlUrl = "https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/$tag/mpv-dev-x86_64-v3-${tag}.7z"
|
||||||
@@ -61,56 +44,65 @@ jobs:
|
|||||||
7z x mpv-dev.7z -ompv-dev
|
7z x mpv-dev.7z -ompv-dev
|
||||||
Copy-Item mpv-dev\libmpv-2.dll .
|
Copy-Item mpv-dev\libmpv-2.dll .
|
||||||
|
|
||||||
# ── macOS: install via Homebrew ──────────────────────────
|
|
||||||
- name: Install native deps (macOS)
|
|
||||||
if: runner.os == 'macOS'
|
|
||||||
run: |
|
|
||||||
brew install mpv ffmpeg
|
|
||||||
# Copy dylibs so PyInstaller bundles them
|
|
||||||
MPV_LIB=$(brew --prefix mpv)/lib/libmpv.2.dylib
|
|
||||||
cp "$MPV_LIB" .
|
|
||||||
cp "$(brew --prefix ffmpeg)/bin/ffmpeg" .
|
|
||||||
cp "$(brew --prefix ffmpeg)/bin/ffprobe" .
|
|
||||||
|
|
||||||
# ── Build ────────────────────────────────────────────────
|
|
||||||
- name: Build with PyInstaller
|
- name: Build with PyInstaller
|
||||||
run: pyinstaller 8cut.spec
|
run: pyinstaller 8cut.spec
|
||||||
|
|
||||||
# ── Fix macOS dylib paths ────────────────────────────────
|
- name: Package
|
||||||
- name: Fix dylib rpaths (macOS)
|
shell: pwsh
|
||||||
if: runner.os == 'macOS'
|
run: Compress-Archive -Path dist\8cut\* -DestinationPath 8cut-windows.zip
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 8cut-windows
|
||||||
|
path: 8cut-windows.zip
|
||||||
|
|
||||||
|
# ── macOS (Apple Silicon) ──────────────────────────────────
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- name: Install Python dependencies
|
||||||
|
run: pip install pyinstaller PyQt6 python-mpv
|
||||||
|
|
||||||
|
- name: Install native deps
|
||||||
|
run: |
|
||||||
|
brew install mpv ffmpeg
|
||||||
|
cp "$(brew --prefix mpv)/lib/libmpv.2.dylib" .
|
||||||
|
cp "$(brew --prefix ffmpeg)/bin/ffmpeg" .
|
||||||
|
cp "$(brew --prefix ffmpeg)/bin/ffprobe" .
|
||||||
|
|
||||||
|
- name: Build with PyInstaller
|
||||||
|
run: pyinstaller 8cut.spec
|
||||||
|
|
||||||
|
- name: Fix dylib rpaths
|
||||||
run: |
|
run: |
|
||||||
# Rewrite libmpv load path to be relative
|
|
||||||
DYLIB="dist/8cut/libmpv.2.dylib"
|
DYLIB="dist/8cut/libmpv.2.dylib"
|
||||||
if [ -f "$DYLIB" ]; then
|
if [ -f "$DYLIB" ]; then
|
||||||
install_name_tool -id @executable_path/libmpv.2.dylib "$DYLIB"
|
install_name_tool -id @executable_path/libmpv.2.dylib "$DYLIB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Package ──────────────────────────────────────────────
|
- name: Package
|
||||||
- name: Package (Windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
|
||||||
run: Compress-Archive -Path dist\8cut\* -DestinationPath ${{ matrix.artifact }}.zip
|
|
||||||
|
|
||||||
- name: Package (macOS)
|
|
||||||
if: runner.os == 'macOS'
|
|
||||||
run: |
|
run: |
|
||||||
cd dist
|
cd dist
|
||||||
zip -r ../${{ matrix.artifact }}.zip 8cut.app
|
zip -r ../8cut-macos-arm64.zip 8cut.app
|
||||||
|
|
||||||
# ── Upload artifact ──────────────────────────────────────
|
- name: Upload artifact
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.artifact }}
|
name: 8cut-macos-arm64
|
||||||
path: ${{ matrix.artifact }}.zip
|
path: 8cut-macos-arm64.zip
|
||||||
|
|
||||||
# ── Create GitHub Release ──────────────────────────────────
|
# ── Create GitHub Release ──────────────────────────────────
|
||||||
release:
|
release:
|
||||||
needs: build
|
needs: [windows, macos]
|
||||||
|
if: ${{ always() && startsWith(github.ref, 'refs/tags/v') && (needs.windows.result == 'success' || needs.macos.result == 'success') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user