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.

fix(release): rebase generated branches onto main (#2293)

Francesco Bonacci8260409810b3
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.py
index 7576a9fe5c..bdc1dc563e 100644
--- a/.github/scripts/tests/test_cua_driver_release_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py
@@ -52,6 +52,9 @@ class TestCuaDriverReleaseWiring(unittest.TestCase):
'git fetch origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH"',
workflow,
)
+ self.assertIn("git rebase origin/main", workflow)
+ self.assertIn('--force-with-lease="refs/heads/$BRANCH:$REMOTE_HEAD"', workflow)
+ self.assertNotIn("git push --force ", workflow)
self.assertIn("sync_lume_release_docs.py", workflow)
self.assertIn("chore(lume): synchronize release documentation", workflow)
self.assertNotIn("if: steps.release.outputs.prs_created == 'true'", workflow)
@@ -96,9 +99,7 @@ class TestCuaDriverReleaseWiring(unittest.TestCase):
self.assertNotIn(' - "libs/cua-driver/rust/**"', workflow)
self.assertEqual(
- workflow.count(
- ' - ".github/workflows/ci-distro-compat-cua-driver.yml"'
- ),
+ workflow.count(' - ".github/workflows/ci-distro-compat-cua-driver.yml"'),
2,
)
self.assertIn(' - "cua-driver-rs-v*"', workflow)
@@ -111,9 +112,7 @@ class TestCuaDriverReleaseWiring(unittest.TestCase):
".github/workflows/ci-rust-windows.yml",
):
workflow = self.read(relative_path)
- self.assertNotIn(
- ' - "libs/cua-driver/rust/**"', workflow, relative_path
- )
+ self.assertNotIn(' - "libs/cua-driver/rust/**"', workflow, relative_path)
self.assertIn(
' - "libs/cua-driver/rust/crates/cua-driver/**"',
workflow,
diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml
index 9f3d17b12b..d5ba2df9bc 100644
--- a/.github/workflows/release-please.yml
+++ b/.github/workflows/release-please.yml
@@ -63,10 +63,16 @@ jobs:
exit 1
fi
- # release-please updates the remote branch after checkout, so the
- # checkout-created remote-tracking ref can no longer fast-forward.
+ # Release Please can update an existing branch that predates the
+ # current workflow. Refresh it, then replay only this trusted bot
+ # branch onto main so validation uses the current release tooling.
+ git fetch origin "+refs/heads/main:refs/remotes/origin/main"
git fetch origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH"
+ REMOTE_HEAD=$(git rev-parse "origin/$BRANCH")
git checkout -B "$BRANCH" "origin/$BRANCH"
+ git config user.name "trycua-release[bot]"
+ git config user.email "trycua-release[bot]@users.noreply.github.com"
+ git rebase origin/main
if [[ "$DRIVER" == "true" ]]; then
DRIVER_VERSION=$(tr -d '[:space:]' < libs/cua-driver/rust/VERSION)
cargo update --manifest-path libs/cua-driver/rust/Cargo.toml \
@@ -83,12 +89,13 @@ jobs:
fi
if git diff --cached --quiet; then
echo "Generated files already match release PR #$number"
- continue
+ else
+ git commit -m "$COMMIT_MESSAGE"
+ fi
+ if [[ "$(git rev-parse HEAD)" != "$REMOTE_HEAD" ]]; then
+ git push --force-with-lease="refs/heads/$BRANCH:$REMOTE_HEAD" \
+ origin "HEAD:refs/heads/$BRANCH"
fi
- git config user.name "trycua-release[bot]"
- git config user.email "trycua-release[bot]@users.noreply.github.com"
- git commit -m "$COMMIT_MESSAGE"
- git push origin "HEAD:$BRANCH"
done < <(gh pr list --state open --base main --limit 100 --json number --jq '.[].number')
- name: Verify repository release versions