split shim releases into per-package branches (#59)
This commit is contained in:
@@ -42,9 +42,9 @@ contributions welcome for other platforms!
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
dependencies = [
|
dependencies = [
|
||||||
# use the releases branch for pre-built wheels
|
# use per-package release branches for pre-built wheels
|
||||||
"capnproto @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=capnproto",
|
"capnproto @ git+https://github.com/commaai/dependencies.git@release-capnproto#subdirectory=capnproto",
|
||||||
"ffmpeg @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=ffmpeg",
|
"ffmpeg @ git+https://github.com/commaai/dependencies.git@release-ffmpeg#subdirectory=ffmpeg",
|
||||||
|
|
||||||
# use the master branch to build the package on pip install
|
# use the master branch to build the package on pip install
|
||||||
"capnproto @ git+https://github.com/commaai/dependencies.git@master#subdirectory=capnproto",
|
"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
|
* start a new top-level directory as a new package
|
||||||
* `./test.sh` tests the building of all packages
|
* `./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
|
* 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-<package>` branch contains a single shim package, so old lockfiles keep resolving even as new packages are added
|
||||||
|
|||||||
30
release.sh
30
release.sh
@@ -29,7 +29,7 @@ for toml in */pyproject.toml; do
|
|||||||
done
|
done
|
||||||
shopt -u nullglob
|
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)"
|
TMP_DIR="$(mktemp -d)"
|
||||||
python3 - "$TMP_DIR" "$REPO" <<'PY'
|
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 ""
|
datadir = patterns[0].split("/", 1)[0] if patterns and patterns[0] else ""
|
||||||
scripts = data.get("project", {}).get("scripts", {}) or {}
|
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 = pkg_dir / module
|
||||||
mod_dir.mkdir(parents=True, exist_ok=True)
|
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")
|
(pkg_dir / "pyproject.toml").write_text("\n".join(lines) + "\n")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
(
|
shopt -s nullglob
|
||||||
cd "$TMP_DIR"
|
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 init
|
||||||
git checkout -b releases
|
git checkout -b "$branch"
|
||||||
git add .
|
git add "$pkg"
|
||||||
git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" commit -m "update shim packages"
|
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 remote add origin "https://x-access-token:${TOKEN}@github.com/${REPO}.git"
|
||||||
git push -f origin releases
|
git push -f origin "$branch"
|
||||||
)
|
)
|
||||||
|
done
|
||||||
|
shopt -u nullglob
|
||||||
|
|
||||||
rm -rf "$TMP_DIR"
|
rm -rf "$TMP_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user