Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix publish action

Nick Sweeting4196e79faa61
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 7449ab57b..153d3aa95 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -66,13 +66,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: actions/setup-python@v5
+ - uses: astral-sh/setup-uv@v6
with:
- python-version: "3.11"
- - uses: astral-sh/setup-uv@v5
+ enable-cache: true
+ activate-environment: true
+ - run: uv sync
+
- run: uv run ruff check --no-fix --select PLE # quick check for syntax errors to avoid waiting time doing the rest of the build
- run: uv build
+
+ - name: Detect installed Playwright version
+ run: echo "PLAYWRIGHT_VERSION=$(uv pip list --format json | jq -r '.[] | select(.name == "playwright") | .version')" >> $GITHUB_ENV
+
+ - name: Cache playwright binaries
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cache/ms-playwright
+ key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
+
+ - run: playwright install chrome
+ - run: playwright install chromium
+
+ # TODO: just depend on the other test.yml action for this instead of re-running the tests here
- run: uv run pytest tests/ci # dont push the package to PyPI if the tests fail
+
+ # publish to PyPI
- run: uv publish --trusted-publishing always
- name: Push to stable branch (if stable release)
if: github.event_name == 'release' && !contains(github.ref_name, 'rc')