ci: add tag-driven release workflow and centralize pinned versions

- Introduce ci/versions.env as the single source of truth for the mpv tag
  and every dependency pin; the three build scripts and all workflows now
  source it instead of redeclaring versions inline.
- Add release.yml: on a v* tag it reuses the three per-platform build
  workflows (workflow_call) and publishes the bare libmpv.so / .dll / .dylib
  assets plus a combined checksums.txt as a GitHub Release.
- Rework build-*.yml: trigger on pull_request (PR check) and workflow_call
  instead of push to main, and expose the artifact name/version as job
  outputs so release.yml can assemble the release assets.
- Route the Linux build through ccache (CC/CXX) so the CI ccache is actually
  populated and reused, fixing the 'Path Validation Error' on cache save.
This commit is contained in:
david
2026-10-02 19:11:15 +02:00
parent 8ad01bbab1
commit bcb7263ec6
8 changed files with 191 additions and 70 deletions
+26 -13
View File
@@ -12,23 +12,29 @@ name: build-linux
# font stack: libass (a hard mpv dependency) needs fontconfig (-> expat) where
# macOS/Windows use CoreText/DirectWrite.
#
# Pinned to mpv v0.41.0 - the version whose client API (131077) the jlibmpv
# JNA bindings are validated against. Bump the ref here for a libmpv update.
# The build recipe (dependency versions, static flags) lives in
# ci/build-libmpv-linux.sh in this repository.
# Pinned to the mpv tag in ci/versions.env - the version whose client API
# (131077) the jlibmpv JNA bindings are validated against. Bump MPV_REF (and
# the dependency pins) there for a libmpv update. The build recipe
# (dependency versions, static flags) lives in ci/build-libmpv-linux.sh.
#
# Triggers: pull requests (all three build workflows act as the PR check),
# manual workflow_dispatch, and workflow_call from release.yml on tag push.
# A push to main builds nothing on its own.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
env:
MPV_REF: v0.41.0
TARGET: x86_64-linux
jobs:
build:
linux:
runs-on: ubuntu-24.04
outputs:
artifact-name: ${{ steps.artifact.outputs.name }}
version: ${{ steps.artifact.outputs.version }}
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
@@ -39,11 +45,17 @@ jobs:
with:
fetch-depth: 1
- name: Load pinned versions
id: versions
run: |
source ci/versions.env
echo "mpv_ref=$MPV_REF" >> "$GITHUB_OUTPUT"
- name: Check out mpv (pinned tag)
uses: actions/checkout@v4
with:
repository: mpv-player/mpv
ref: ${{ env.MPV_REF }}
ref: ${{ steps.versions.outputs.mpv_ref }}
path: mpv
fetch-depth: 1
@@ -118,12 +130,13 @@ jobs:
id: artifact
run: |
VER=$(cat mpv/MPV_VERSION | tr -d '[:space:]')
echo "name=mpv-natives-linux-x86_64-mpv-$VER" >> "$GITHUB_OUTPUT"
# Intermediate artifact is a per-platform directory (zipped by
# upload-artifact) containing libmpv.so + checksums.txt. release.yml
# downloads it and re-uploads the bare .so as the final release asset
# named <name>-<VER>.so.
echo "name=mpv-natives-linux-x86_64" >> "$GITHUB_OUTPUT"
echo "version=$VER" >> "$GITHUB_OUTPUT"
# upload-artifact zips the directory itself, so handing it the folder
# (not a pre-zipped file) yields a single-level archive without the
# double-zip wrapper.
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
+28 -11
View File
@@ -10,21 +10,25 @@ name: build-macos
# approach as the Windows build). jlibmpv expects the file name
# `libmpv.dylib` (no -2) and one universal binary for both architectures.
#
# Pinned to mpv v0.41.0 — the version whose client API (131077) the jlibmpv
# JNA bindings are validated against. Bump the ref here for a libmpv update.
# The build recipe lives in ci/build-libmpv-macos.sh in this repository.
# Pinned to the mpv tag in ci/versions.env - the version whose client API
# (131077) the jlibmpv JNA bindings are validated against. Bump MPV_REF (and
# the dependency pins) there for a libmpv update. The build recipe lives in
# ci/build-libmpv-macos.sh.
#
# Triggers: pull requests (PR check), manual workflow_dispatch, and
# workflow_call from release.yml on tag push. A push to main builds nothing.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
MPV_REF: v0.41.0
workflow_call:
jobs:
build:
macos:
runs-on: macos-15
outputs:
artifact-name: ${{ steps.artifact.outputs.name }}
version: ${{ steps.artifact.outputs.version }}
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
@@ -35,11 +39,17 @@ jobs:
with:
fetch-depth: 1
- name: Load pinned versions
id: versions
run: |
source ci/versions.env
echo "mpv_ref=$MPV_REF" >> "$GITHUB_OUTPUT"
- name: Check out mpv (pinned tag)
uses: actions/checkout@v4
with:
repository: mpv-player/mpv
ref: ${{ env.MPV_REF }}
ref: ${{ steps.versions.outputs.mpv_ref }}
path: mpv
fetch-depth: 1
@@ -92,10 +102,17 @@ jobs:
cat artifact-libmpv/checksums.txt
ls -l artifact-libmpv
- name: Artifact name
id: artifact
run: |
VER=$(cat mpv/MPV_VERSION | tr -d '[:space:]')
echo "name=mpv-natives-macos-universal" >> "$GITHUB_OUTPUT"
echo "version=$VER" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mpv-natives-macos-universal-mpv-${{ env.MPV_REF }}
name: ${{ steps.artifact.outputs.name }}
path: artifact-libmpv
- name: Save ccache
+21 -13
View File
@@ -5,23 +5,28 @@ name: build-windows
# into the one DLL together with a static CRT, so the artifact has no runtime
# dependency closure to ship (unlike mpv's own shared-DLL CI build).
#
# Pinned to mpv v0.41.0 — the version whose client API (131077) the jlibmpv
# JNA bindings are validated against. Bump the ref here for a libmpv update.
# The build recipe (dependency versions, static flags) lives in
# ci/build-libmpv-mingw64.sh in this repository.
# Pinned to the mpv tag in ci/versions.env - the version whose client API
# (131077) the jlibmpv JNA bindings are validated against. Bump MPV_REF (and
# the dependency pins) there for a libmpv update. The build recipe lives in
# ci/build-libmpv-mingw64.sh.
#
# Triggers: pull requests (PR check), manual workflow_dispatch, and
# workflow_call from release.yml on tag push. A push to main builds nothing.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
env:
MPV_REF: v0.41.0
TARGET: x86_64-w64-mingw32
jobs:
build:
windows:
runs-on: ubuntu-24.04
outputs:
artifact-name: ${{ steps.artifact.outputs.name }}
version: ${{ steps.artifact.outputs.version }}
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
@@ -32,11 +37,17 @@ jobs:
with:
fetch-depth: 1
- name: Load pinned versions
id: versions
run: |
source ci/versions.env
echo "mpv_ref=$MPV_REF" >> "$GITHUB_OUTPUT"
- name: Check out mpv (pinned tag)
uses: actions/checkout@v4
with:
repository: mpv-player/mpv
ref: ${{ env.MPV_REF }}
ref: ${{ steps.versions.outputs.mpv_ref }}
path: mpv
fetch-depth: 1
@@ -86,12 +97,9 @@ jobs:
id: artifact
run: |
VER=$(cat mpv/MPV_VERSION | tr -d '[:space:]')
echo "name=mpv-natives-windows-x86_64-mpv-$VER" >> "$GITHUB_OUTPUT"
echo "name=mpv-natives-windows-x86_64" >> "$GITHUB_OUTPUT"
echo "version=$VER" >> "$GITHUB_OUTPUT"
# upload-artifact zips the directory itself, so handing it the folder
# (not a pre-zipped file) yields a single-level archive without the
# double-zip wrapper.
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
+69
View File
@@ -0,0 +1,69 @@
name: release
# Publishes the self-contained libmpv for all three platforms as a GitHub
# Release. Triggered by pushing a tag of the form v<mpv-version> (e.g.
# v0.41.0). It reuses the three per-platform build workflows and re-uploads
# their single-file artifacts as bare release assets plus a combined
# checksums.txt.
#
# Asset names are derived from each build job's output and the mpv version
# read from the mpv source tree, so the release tag and the mpv version stay
# in sync:
# mpv-natives-linux-x86_64-<ver>.so
# mpv-natives-windows-x86_64-<ver>.dll
# mpv-natives-macos-universal-<ver>.dylib
# checksums.txt
#
# jlibmpv's RemoteNativeLocator resolves the download URL deterministically
# from (platform, mpv version) against these names.
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
build-linux:
uses: ./.github/workflows/build-linux.yml
build-windows:
uses: ./.github/workflows/build-windows.yml
build-macos:
uses: ./.github/workflows/build-macos.yml
publish:
needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-24.04
steps:
- name: Download platform artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Assemble bare release assets
run: |
VER="${{ needs.build-linux.outputs.version }}"
[ -n "$VER" ] || { echo "ERROR: mpv version not set"; exit 1; }
mkdir -p release
# linux: single self-contained libmpv.so
cp "artifacts/mpv-natives-linux-x86_64/libmpv.so" \
"release/mpv-natives-linux-x86_64-${VER}.so"
# windows: single self-contained libmpv-*.dll (static CRT, no closure)
cp artifacts/mpv-natives-windows-x86_64/libmpv-*.dll \
"release/mpv-natives-windows-x86_64-${VER}.dll"
# macos: single universal libmpv.dylib
cp "artifacts/mpv-natives-macos-universal/libmpv.dylib" \
"release/mpv-natives-macos-universal-${VER}.dylib"
(cd release && sha256sum * > checksums.txt)
echo "=== release assets ==="
ls -l release
echo "=== checksums ==="
cat release/checksums.txt
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: release/*
generate_release_notes: false
+9 -13
View File
@@ -33,8 +33,12 @@ mkdir -p "$prefix_dir"
wget="wget -nc --progress=bar:force"
export CC=gcc
export CXX=g++
# Route compilation through ccache (honored by ffmpeg's configure, meson and
# CMake alike) so rebuilds after a versions.env bump reuse cached objects. In
# CI the cache dir is provided by the workflow (CCACHE_DIR).
CCACHE=${CCACHE:-ccache}
export CC="$CCACHE gcc"
export CXX="$CCACHE g++"
export AR=ar
export NM=nm
export RANLIB=ranlib
@@ -47,17 +51,9 @@ export LDFLAGS=""
export PKG_CONFIG_PATH="$prefix_dir/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
# --- Pinned dependency versions -------------------------------------------
# Latest stable tag on or before the mpv v0.41.0 release (2025-12-21).
FFMPEG_VER=n8.0.1
DAV1D_VER=1.5.2
LIBPLACEBO_VER=v7.351.0
LIBASS_VER=0.17.4
LCMS2_VER=lcms2.17
FREETYPE_VER=2.14.1
FRIBIDI_VER=1.0.16
HARFBUZZ_VER=12.2.0
FONTCONFIG_VER=2.16.2
EXPAT_VER=R_2_7_3
# Centralized in ci/versions.env (single source of truth shared with the other
# platforms and with CI). Bump mpv + deps there.
. "$(dirname "$0")/versions.env"
# Static everywhere: every dependency becomes a .a archive that gets linked
# into the single libmpv.so. (mpv's own script ships shared libs instead.)
+3 -9
View File
@@ -50,15 +50,9 @@ export LDFLAGS=""
export PKG_CONFIG_PATH="$prefix_dir/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
# --- Pinned dependency versions -------------------------------------------
# Latest stable tag on or before the mpv v0.41.0 release (2025-12-21).
FFMPEG_VER=n8.0.1
DAV1D_VER=1.5.2
LIBPLACEBO_VER=v7.351.0
LIBASS_VER=0.17.4
LCMS2_VER=lcms2.17
FREETYPE_VER=2.14.1
FRIBIDI_VER=1.0.16
HARFBUZZ_VER=12.2.0
# Centralized in ci/versions.env (single source of truth shared with the other
# platforms and with CI). Bump mpv + deps there.
. "$(dirname "$0")/versions.env"
# Static everywhere: every dependency becomes a .a archive that gets linked
# into the single libmpv dylib. (mpv's own script ships shared libs instead.)
+3 -11
View File
@@ -48,17 +48,9 @@ export PKG_CONFIG_SYSROOT_DIR="$prefix_dir"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig"
# --- Pinned dependency versions -------------------------------------------
# Latest stable tag on or before the mpv v0.41.0 release (2025-12-21).
FFMPEG_VER=n8.0.1
DAV1D_VER=1.5.2
LIBPLACEBO_VER=v7.351.0
LIBASS_VER=0.17.4
LCMS2_VER=lcms2.17
ICONV_VER=1.18
ZLIB_VER=1.3.1
FREETYPE_VER=2.14.1
FRIBIDI_VER=1.0.16
HARFBUZZ_VER=12.2.0
# Centralized in ci/versions.env (single source of truth shared with the other
# platforms and with CI). Bump mpv + deps there.
. "$(dirname "$0")/versions.env"
# Static everywhere: every dependency becomes a .a archive that gets linked
# into the single libmpv-2.dll. (mpv's own script ships shared .dlls instead.)
+32
View File
@@ -0,0 +1,32 @@
# Single source of truth for every pinned version in this repository.
#
# Bumping mpv: change MPV_REF and, if the new mpv release ships newer
# dependencies, bump the affected *_VER variables in the same commit.
#
# Every build script and every workflow sources this file. Do not duplicate
# version numbers anywhere else.
#
# All versions are the latest stable tags that existed on or before the
# mpv v0.41.0 release (2025-12-21), so a rebuild reproduces the same
# binary instead of drifting to upstream git HEAD.
# --- mpv itself -----------------------------------------------------------
MPV_REF=v0.41.0
# --- shared by all three platforms ----------------------------------------
FFMPEG_VER=n8.0.1
DAV1D_VER=1.5.2
LIBPLACEBO_VER=v7.351.0
LIBASS_VER=0.17.4
LCMS2_VER=lcms2.17
FREETYPE_VER=2.14.1
FRIBIDI_VER=1.0.16
HARFBUZZ_VER=12.2.0
# --- linux only (fontconfig is the Linux font provider for libass) --------
FONTCONFIG_VER=2.16.2
EXPAT_VER=R_2_7_3
# --- windows only (no system zlib/iconv on MinGW) -------------------------
ICONV_VER=1.18
ZLIB_VER=1.3.1