From 6bc1fe9a9a7a253af73f05d6afeb0317a4002789 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 14 Mar 2026 14:42:00 -0700 Subject: [PATCH] split shim releases into per-package branches (#59) --- README.md | 8 ++++---- release.sh | 34 +++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7f860fa..8736a7b 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,9 @@ contributions welcome for other platforms! ```python dependencies = [ - # use the releases branch for pre-built wheels - "capnproto @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=capnproto", - "ffmpeg @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=ffmpeg", + # use per-package release branches for pre-built wheels + "capnproto @ git+https://github.com/commaai/dependencies.git@release-capnproto#subdirectory=capnproto", + "ffmpeg @ git+https://github.com/commaai/dependencies.git@release-ffmpeg#subdirectory=ffmpeg", # use the master branch to build the package on pip install "capnproto @ git+https://github.com/commaai/dependencies.git@master#subdirectory=capnproto", @@ -58,4 +58,4 @@ to add a new package: * start a new top-level directory as a new package * `./test.sh` tests the building of all packages * on pushes to `master`, wheels are built for our target platforms and pushed to a GitHub release -* the `releases` branch contains shim packages that allow pointing to a git branch and always getting the appropriate wheel for your platform +* each `release-` branch contains a single shim package, so old lockfiles keep resolving even as new packages are added diff --git a/release.sh b/release.sh index aadfd51..6d40a83 100755 --- a/release.sh +++ b/release.sh @@ -29,7 +29,7 @@ for toml in */pyproject.toml; do done shopt -u nullglob -TOKEN="$(gh auth token 2>/dev/null)" || { echo "set GH_TOKEN to publish shim branch" >&2; exit 1; } +TOKEN="$(gh auth token 2>/dev/null)" || { echo "set GH_TOKEN to publish shim branches" >&2; exit 1; } TMP_DIR="$(mktemp -d)" python3 - "$TMP_DIR" "$REPO" <<'PY' @@ -55,7 +55,8 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")): datadir = patterns[0].split("/", 1)[0] if patterns and patterns[0] else "" scripts = data.get("project", {}).get("scripts", {}) or {} - pkg_dir = tmp_dir / pkg + repo_dir = tmp_dir / pkg + pkg_dir = repo_dir / pkg mod_dir = pkg_dir / module mod_dir.mkdir(parents=True, exist_ok=True) @@ -118,14 +119,25 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")): (pkg_dir / "pyproject.toml").write_text("\n".join(lines) + "\n") PY -( - cd "$TMP_DIR" - git init - git checkout -b releases - git add . - git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" commit -m "update shim packages" - git remote add origin "https://x-access-token:${TOKEN}@github.com/${REPO}.git" - git push -f origin releases -) +shopt -s nullglob +for repo_dir in "$TMP_DIR"/*; do + [[ -d "$repo_dir" ]] || continue + + pkg="$(basename "$repo_dir")" + branch="release-$pkg" + + echo "[$pkg] Publishing shim branch $branch" + + ( + cd "$repo_dir" + git init + git checkout -b "$branch" + git add "$pkg" + git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" commit -m "update $pkg shim" + git remote add origin "https://x-access-token:${TOKEN}@github.com/${REPO}.git" + git push -f origin "$branch" + ) +done +shopt -u nullglob rm -rf "$TMP_DIR"