Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J7imThHV9BMkG24GaxPDeq
127 lines
5.4 KiB
YAML
127 lines
5.4 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt pyinstaller
|
|
- name: Version
|
|
shell: bash
|
|
run: echo "VERSION=$(python -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
|
|
- name: Icons
|
|
run: python packaging/make_icons.py
|
|
- name: Fetch libmpv (gapless, EQ, CD playback & ripping)
|
|
continue-on-error: true
|
|
shell: pwsh
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
$rel = Invoke-RestMethod "https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest" -Headers @{ Authorization = "Bearer $env:GH_TOKEN" }
|
|
$asset = $rel.assets | Where-Object { $_.name -match '^mpv-dev-x86_64-\d{8}-git-[0-9a-f]+\.7z$' } | Select-Object -First 1
|
|
if (-not $asset) { throw "libmpv asset not found" }
|
|
Invoke-WebRequest $asset.browser_download_url -OutFile mpv-dev.7z
|
|
7z x mpv-dev.7z -ompv-dev -y | Out-Null
|
|
New-Item -ItemType Directory -Force packaging/windows/mpv | Out-Null
|
|
Copy-Item mpv-dev/libmpv-2.dll packaging/windows/mpv/
|
|
Get-ChildItem packaging/windows/mpv
|
|
- name: PyInstaller
|
|
run: pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work
|
|
- name: Portable zip
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Force dist | Out-Null
|
|
Compress-Archive -Path build/dist/Mulberry -DestinationPath "dist/Mulberry-Windows-Portable.zip"
|
|
- name: Installer (Inno Setup)
|
|
shell: pwsh
|
|
run: |
|
|
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
|
|
if (-not (Test-Path $iscc)) { choco install innosetup -y --no-progress; $iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" }
|
|
& $iscc "/DAppVersion=$env:VERSION" packaging\windows\mulberry.iss
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: windows
|
|
path: dist/*
|
|
|
|
linux:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: System packages
|
|
run: sudo apt-get update && sudo apt-get install -y libegl1 libxkbcommon0 libxcb-cursor0 desktop-file-utils file
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt pyinstaller
|
|
- name: Version
|
|
run: echo "VERSION=$(python -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
|
|
- name: Icons
|
|
run: python packaging/make_icons.py
|
|
- name: PyInstaller
|
|
run: pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work
|
|
- name: Tarball
|
|
run: |
|
|
mkdir -p dist
|
|
cp mulberry.desktop mulberry/assets/mulberry.svg build/dist/Mulberry/
|
|
tar -C build/dist -czf "dist/Mulberry-Linux-x86_64.tar.gz" Mulberry
|
|
- name: AppImage
|
|
run: |
|
|
APPDIR=build/AppDir
|
|
mkdir -p $APPDIR/usr/lib $APPDIR/usr/share/icons/hicolor/256x256/apps $APPDIR/usr/share/applications
|
|
cp -r build/dist/Mulberry $APPDIR/usr/lib/mulberry
|
|
cp packaging/linux/AppRun $APPDIR/AppRun && chmod +x $APPDIR/AppRun
|
|
grep -v '^Actions=\|^\[Desktop Action\|^Name=Play\|^Name=Next\|^Name=Previous\|^Exec=dbus' mulberry.desktop > $APPDIR/mulberry.desktop
|
|
cp $APPDIR/mulberry.desktop $APPDIR/usr/share/applications/
|
|
cp packaging/build-icons/mulberry-256.png $APPDIR/mulberry.png
|
|
cp packaging/build-icons/mulberry-256.png $APPDIR/usr/share/icons/hicolor/256x256/apps/mulberry.png
|
|
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
|
|
chmod +x appimagetool
|
|
ARCH=x86_64 ./appimagetool --appimage-extract-and-run $APPDIR "dist/Mulberry-x86_64.AppImage"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: linux
|
|
path: dist/*
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [windows, linux]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/**/*
|
|
name: Mulberry ${{ github.ref_name }}
|
|
body: |
|
|
## Downloads
|
|
| Platform | File |
|
|
|---|---|
|
|
| Windows 10/11 installer | **Mulberry-Windows-Setup.exe** |
|
|
| Windows portable | **Mulberry-Windows-Portable.zip** (unzip, run `Mulberry.exe`) |
|
|
| Linux, any distro | **Mulberry-x86_64.AppImage** (`chmod +x`, then run) |
|
|
| Linux tarball | **Mulberry-Linux-x86_64.tar.gz** (run `Mulberry/mulberry`) |
|
|
|
|
On Linux, install `mpv` from your package manager for gapless playback, the EQ and CD support.
|
|
See the [README](https://github.com/${{ github.repository }}#readme) for everything else.
|
|
generate_release_notes: true
|