mirror of
https://github.com/kirbylink/mpv-natives
synced 2026-11-28 12:02:27 +01:00
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:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user