116 lines
3.6 KiB
YAML
116 lines
3.6 KiB
YAML
name: Build & Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
# ── Windows ────────────────────────────────────────────────
|
|
windows:
|
|
runs-on: windows-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: Fetch ffmpeg
|
|
shell: pwsh
|
|
run: |
|
|
$ffUrl = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
|
|
Invoke-WebRequest $ffUrl -OutFile ffmpeg.zip
|
|
Expand-Archive ffmpeg.zip -DestinationPath ffmpeg-tmp
|
|
$bin = Get-ChildItem -Path ffmpeg-tmp -Recurse -Filter ffmpeg.exe | Select-Object -First 1
|
|
Copy-Item "$($bin.DirectoryName)\ffmpeg.exe" .
|
|
Copy-Item "$($bin.DirectoryName)\ffprobe.exe" .
|
|
|
|
- name: Fetch libmpv
|
|
shell: pwsh
|
|
run: |
|
|
$release = Invoke-RestMethod "https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest"
|
|
$asset = $release.assets | Where-Object { $_.name -like "mpv-dev-x86_64-v3-*" } | Select-Object -First 1
|
|
Invoke-WebRequest $asset.browser_download_url -OutFile mpv-dev.7z
|
|
7z x mpv-dev.7z -ompv-dev
|
|
Copy-Item mpv-dev\libmpv-2.dll .
|
|
|
|
- name: Build with PyInstaller
|
|
run: pyinstaller 8cut.spec
|
|
|
|
- name: Package
|
|
shell: pwsh
|
|
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: |
|
|
DYLIB="dist/8cut/libmpv.2.dylib"
|
|
if [ -f "$DYLIB" ]; then
|
|
install_name_tool -id @executable_path/libmpv.2.dylib "$DYLIB"
|
|
fi
|
|
|
|
- name: Package
|
|
run: |
|
|
cd dist
|
|
zip -r ../8cut-macos-arm64.zip 8cut.app
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: 8cut-macos-arm64
|
|
path: 8cut-macos-arm64.zip
|
|
|
|
# ── Create GitHub Release ──────────────────────────────────
|
|
release:
|
|
needs: [windows, macos]
|
|
if: ${{ always() && startsWith(github.ref, 'refs/tags/v') && (needs.windows.result == 'success' || needs.macos.result == 'success') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
draft: false
|
|
generate_release_notes: true
|
|
files: artifacts/**/*.zip
|