Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

cd(cua-driver): bake latest version into install.sh after each release (#1517)

ddupont200b36ab3dca
diff --git a/.github/workflows/cd-swift-cua-driver.yml b/.github/workflows/cd-swift-cua-driver.yml
index 2b6951aede..783fc0dcfd 100644
--- a/.github/workflows/cd-swift-cua-driver.yml
+++ b/.github/workflows/cd-swift-cua-driver.yml
@@ -376,3 +376,24 @@ jobs:
> Supports Apple Silicon (arm64) and Intel (x86_64) — the release tarball contains a universal binary.
generate_release_notes: false
make_latest: true
+
+ - name: Bake version into install.sh
+ if: startsWith(github.ref, 'refs/tags/cua-driver-v')
+ env:
+ VERSION: ${{ steps.set_version.outputs.version }}
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ # Fetch main so we update the live branch, not the detached tag HEAD.
+ git fetch origin main
+ git checkout -B bake-version origin/main
+
+ # Replace the baked version line inside the sentinel block.
+ sed -i '' \
+ "s/^CUA_DRIVER_BAKED_VERSION=.*/CUA_DRIVER_BAKED_VERSION=\"${VERSION}\"/" \
+ libs/cua-driver/scripts/install.sh
+
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git add libs/cua-driver/scripts/install.sh
+ git commit -m "chore(cua-driver): bake version ${VERSION} into install.sh [skip ci]"
+ git push origin bake-version:main
diff --git a/libs/cua-driver/scripts/install.sh b/libs/cua-driver/scripts/install.sh
index 180a2c05da..10aa1df2d2 100755
--- a/libs/cua-driver/scripts/install.sh
+++ b/libs/cua-driver/scripts/install.sh
@@ -62,10 +62,22 @@ for cmd in curl tar; do
done
# --- Resolve release tag ------------------------------------------------
+#
+# Version is resolved in priority order:
+# 1. CUA_DRIVER_VERSION env var (explicit pin)
+# 2. BAKED_VERSION below (set automatically by CD after each release — no API call needed)
+# 3. GitHub Releases API (fallback; unauthenticated = 60 req/hr per IP)
+#
+# ~~~ BAKED_VERSION: auto-updated by CD workflow after each release — do not edit ~~~
+CUA_DRIVER_BAKED_VERSION="0.1.9"
+# ~~~ END_BAKED_VERSION ~~~
if [[ -n "${CUA_DRIVER_VERSION:-}" ]]; then
TAG="${TAG_PREFIX}${CUA_DRIVER_VERSION#v}"
log "using version from CUA_DRIVER_VERSION: $TAG"
+elif [[ -n "${CUA_DRIVER_BAKED_VERSION:-}" ]]; then
+ TAG="${TAG_PREFIX}${CUA_DRIVER_BAKED_VERSION}"
+ log "latest release: $TAG"
else
log "resolving latest $TAG_PREFIX* release via GitHub API"
# `grep -v cua-driver-rs` is defense-in-depth — the Rust port (cua-driver-rs)
@@ -73,7 +85,7 @@ else
# current grep regex `cua-driver-v[^"]+` already excludes it (differs at
# position 11: 'r' vs 'v'), but the negation guards against any future
# regex tweak that might accidentally widen the match.
- TAG=$(curl -fsSL "https://api.github.com/repos/$REPO/releases?per_page=40" \
+ TAG=$(curl -fsSL "https://api.github.com/repos/$REPO/releases?per_page=100" \
| grep -Eo '"tag_name":[[:space:]]*"'"${TAG_PREFIX}"'[^"]+"' \
| grep -v 'cua-driver-rs' \
| sed -E 's/.*"'"${TAG_PREFIX}"'([0-9]+[.][0-9]+[.][0-9]+)"/\1/' \