Files
david 757c540224 build: expose mpv version from reusable build workflows to release
A reusable workflow only exposes top-level workflow_call outputs to the
caller; job outputs are not visible. release.yml read the version from the
build jobs' outputs, which is empty when called via workflow_call, so the
publish job failed with 'mpv version not set' and the v0.41.0 release was
never published.

Each build-* workflow now exposes the version as a workflow_call output,
and release.yml reads it from needs.<job>.outputs.version instead of the
nested needs.<job>.<inner>.outputs.version path.
2026-10-06 13:47:09 +02:00

130 lines
4.5 KiB
YAML

name: build-macos
# Builds a universal (arm64 + x86_64) self-contained libmpv.dylib for macOS
# from mpv source pinned to a release tag. GitHub's macOS runners are all
# arm64 now, so one arm64 runner builds the arm64 slice natively and the
# x86_64 slice via clang --target=x86_64-apple-darwin; a merge step combines
# both with lipo into one universal library and uploads it.
#
# Every dependency is built static and linked into the one dylib (same
# approach as the Windows build). jlibmpv expects the file name
# `libmpv.dylib` (no -2) and one universal binary for both architectures.
#
# 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:
pull_request:
workflow_dispatch:
workflow_call:
# A called (reusable) workflow only exposes top-level `workflow_call`
# outputs to the caller - job outputs are not. release.yml needs the
# mpv version to name the release assets, so expose it here.
outputs:
version:
description: mpv version the built artifact was compiled from
value: ${{ jobs.macos.outputs.version }}
jobs:
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
CCACHE_MAXSIZE: 500M
steps:
- name: Check out mpv-natives (build scripts)
uses: actions/checkout@v4
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: ${{ steps.versions.outputs.mpv_ref }}
path: mpv
fetch-depth: 1
- name: Get time
id: get_time
run: echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
- name: Restore ccache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: macos-${{ steps.get_time.outputs.timestamp }}
restore-keys: macos-
- name: Install dependencies
run: |
# PEP 668: pip installs are blocked on the macOS runner, use brew.
brew install ccache nasm ninja meson
# The vendored build script runs from inside the mpv source tree, once
# per architecture. Each run writes macos_prefix-<arch>/, the meson
# build dir, and the self-contained dylib into mpv/artifact-<arch>/.
- name: Build arm64 slice
working-directory: mpv
env:
ARCH: arm64
run: bash "${{ github.workspace }}/ci/build-libmpv-macos.sh"
- name: Build x86_64 slice
working-directory: mpv
env:
ARCH: x86_64
run: bash "${{ github.workspace }}/ci/build-libmpv-macos.sh"
- name: Print meson logs on failure
if: failure()
run: |
cat mpv/macos_build-arm64/meson-logs/meson-log.txt 2>/dev/null || true
cat mpv/macos_build-x86_64/meson-logs/meson-log.txt 2>/dev/null || true
- name: Create universal dylib
run: |
mkdir -p artifact-libmpv
lipo -create \
mpv/artifact-arm64/libmpv.2.dylib \
mpv/artifact-x86_64/libmpv.2.dylib \
-output artifact-libmpv/libmpv.dylib
lipo -info artifact-libmpv/libmpv.dylib
sha256sum artifact-libmpv/libmpv.dylib > artifact-libmpv/checksums.txt
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: ${{ steps.artifact.outputs.name }}
path: artifact-libmpv
- name: Save ccache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: macos-${{ steps.get_time.outputs.timestamp }}