Skip to content

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

feat: Update GitHub Actions workflow and documentation for branching and tagging strategy

anurag.chatap79a6b40e560c
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 548b389d7..c250c3e38 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,24 +1,56 @@
-# This workflow will upload a Python Package using Twine when a release is created
-# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
-
-# This workflow uses actions that are not certified by GitHub.
-# They are provided by a third-party and are governed by
-# separate terms of service, privacy policy, and support
-# documentation.
-
-name: Upload Python Package
+name: Python Package Workflow
on:
+ push:
+ branches:
+ - main
release:
types: [published]
+ schedule:
+ - cron: "0 17 * * FRI" # Every Friday at 5 PM UTC
permissions:
- contents: read
+ contents: write
jobs:
- deploy:
+ pre_commit_and_tests:
+ if: github.event_name == 'push' && github.ref_name == 'main'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: "3.x"
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pre-commit pytest
+ - name: Run pre-commit hooks
+ run: pre-commit run --all-files
+ - name: Run tests
+ run: pytest
+
+ tag_pre_release:
+ if: github.event_name == 'schedule'
runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Create pre-release tag
+ run: |
+ git fetch --tags
+ latest_tag=$(git tag --list --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$' | head -n 1)
+ if [ -z "$latest_tag" ]; then
+ new_tag="v0.1.0rc1"
+ else
+ new_tag=$(echo $latest_tag | awk -F'rc' '{print $1 "rc" $2+1}')
+ fi
+ git tag $new_tag
+ git push origin $new_tag
+ deploy:
+ if: github.event_name == 'release'
+ runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
@@ -36,3 +68,8 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
+ - name: Push to stable branch (if stable release)
+ if: startsWith(github.ref_name, 'v') && !contains(github.ref_name, 'rc')
+ run: |
+ git checkout -b stable
+ git push origin stable
diff --git a/README.md b/README.md
index 73fc7b006..4311724fc 100644
--- a/README.md
+++ b/README.md
@@ -112,6 +112,23 @@ Contributions are welcome! Feel free to open issues for bugs or feature requests
To learn more about the library, check out the [local setup 📕](https://docs.browser-use.com/development/local-setup).
+
+# Browser Use
+
+## Branching and Tagging Strategy
+
+### Branches
+- **`stable`**: Reflects the latest stable release. Updated only when a new stable release is published.
+- **`main`**: The primary development branch. Updated frequently with the latest changes.
+
+### Tags
+- **`x.x.x`**: Stable release tags, created for production-ready releases.
+- **`x.x.xrcXX`**: Pre-release tags, created for testing and unstable releases.
+
+### Workflow
+- **Push to `main`**: Runs pre-commit hooks and tests.
+- **Stable Releases**: Published to PyPI and updates the `stable` branch.
+- **Pre-Releases**: Published to PyPI as pre-releases every Friday at 5 PM UTC.
---
<div align="center">
diff --git a/docs/dev_docs.md b/docs/dev_docs.md
new file mode 100644
index 000000000..b4076b325
--- /dev/null
+++ b/docs/dev_docs.md
@@ -0,0 +1,21 @@
+# Development Workflow
+
+## Branches
+- **`stable`**: Mirrors the latest stable release. This branch is updated only when a new stable release is published (every few weeks).
+- **`main`**: The primary development branch. This branch is updated frequently (every hour or more).
+
+## Tags
+- **`x.x.x`**: Stable release tags. These are created for stable releases and updated every few weeks.
+- **`x.x.xrcXX`**: Pre-release tags. These are created for unstable pre-releases and updated every Friday at 5 PM UTC.
+
+## Workflow Summary
+1. **Push to `main`**:
+ - Runs pre-commit hooks to fix formatting.
+ - Executes tests to ensure code quality.
+
+2. **Release a new version**:
+ - If the tag is a pre-release (`x.x.xrcXX`), the package is pushed to PyPI as a pre-release.
+ - If the tag is a stable release (`x.x.x`), the package is pushed to PyPI as a stable release, and the `stable` branch is updated to match the release.
+
+3. **Scheduled Pre-Releases**:
+ - Every Friday at 5 PM UTC, a new pre-release tag (`x.x.xrcXX`) is created from the `main` branch and pushed to the repository.