Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Build & Publish Prebuilt Libraries #20

Build & Publish Prebuilt Libraries

Build & Publish Prebuilt Libraries #20

Workflow file for this run

name: Build & Publish Prebuilt Libraries
on:
workflow_dispatch: {}
push:
tags: ["v*"]
permissions:
contents: write
pull-requests: write
concurrency:
group: build-libs-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
- name: Make script executable (POSIX)
if: runner.os != 'Windows'
run: chmod +x ./build_lib.sh
- name: Show platform
shell: bash
run: |
uname -a || true
echo "Runner OS: ${{ runner.os }}"
- name: Build cdylib (release)
shell: bash
run: |
./build_lib.sh release
echo "After build, libs/ contains:"
find libs -maxdepth 2 -type f || true
- name: Upload libs artifact
uses: actions/upload-artifact@v4
with:
name: libs-${{ matrix.os }}
path: libs
if-no-files-found: error
publish:
name: Aggregate & PR commit
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all libs
uses: actions/download-artifact@v4
with:
path: _libs_artifacts
- name: Merge libs into repo
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
mkdir -p libs
echo "Downloaded artifact roots:"
find _libs_artifacts -maxdepth 1 -mindepth 1 -type d -printf " - %f\n"
for src in \
_libs_artifacts/*/{linux_*,darwin_*,windows_*} \
_libs_artifacts/*/libs/{linux_*,darwin_*,windows_*}
do
[ -d "$src" ] || continue
plat="$(basename "$src")"
dest="libs/${plat}"
echo "Syncing $src -> $dest"
mkdir -p "$dest"
rsync -a "$src/." "$dest/"
done
echo "Merged libs layout:"
find libs -maxdepth 2 -type f -print
- name: Create PR with updated libs
uses: peter-evans/create-pull-request@v6
with:
base: ${{ github.event.repository.default_branch }}
commit-message: "chore(libs): update prebuilt libs for ${{ github.ref_name }}"
title: "Update prebuilt libs for ${{ github.ref_name }}"
body: |
This PR updates prebuilt native libraries under `libs/` for:
- Linux x64
- macOS arm64
- macOS x64
- Windows x64
Built via `./build_lib.sh release`.
branch: ci/update-libs/${{ github.ref_name }}
delete-branch: true
signoff: false