Skip to content

Commit 7ee12cb

Browse files
committed
address comments
1 parent 5f00a53 commit 7ee12cb

3 files changed

Lines changed: 64 additions & 11 deletions

File tree

.github/workflows/publish.yml

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Install dependencies
3636
run: |
3737
python -m pip install --upgrade pip
38-
pip install build twine wheel setuptools ruff black tomllib
38+
pip install build twine wheel setuptools ruff black
3939
pip install -r requirements.txt
4040
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
4141
@@ -52,12 +52,60 @@ jobs:
5252
# run: |
5353
# pytest
5454

55-
- name: Get project version
56-
id: get_version
55+
- name: Calculate new version
56+
id: version
5757
run: |
58-
VERSION=$(python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
59-
echo "version=$VERSION" >> $GITHUB_OUTPUT
60-
58+
# Get current version from pyproject.toml
59+
CURRENT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
60+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
61+
62+
# Parse version components
63+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
64+
65+
# Calculate new version based on release type
66+
case "${{ github.event.inputs.release_type }}" in
67+
"major")
68+
NEW_MAJOR=$((MAJOR + 1))
69+
NEW_MINOR=0
70+
NEW_PATCH=0
71+
;;
72+
"minor")
73+
NEW_MAJOR=$MAJOR
74+
NEW_MINOR=$((MINOR + 1))
75+
NEW_PATCH=0
76+
;;
77+
"patch")
78+
NEW_MAJOR=$MAJOR
79+
NEW_MINOR=$MINOR
80+
NEW_PATCH=$((PATCH + 1))
81+
;;
82+
esac
83+
84+
NEW_VERSION="${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}"
85+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
86+
echo "Bumping version from $CURRENT_VERSION to $NEW_VERSION"
87+
88+
- name: Update version files
89+
run: |
90+
CURRENT_VERSION="${{ steps.version.outputs.current_version }}"
91+
NEW_VERSION="${{ steps.version.outputs.new_version }}"
92+
93+
# Update pyproject.toml
94+
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" pyproject.toml
95+
96+
# Update __init__.py
97+
sed -i "s/__version__ = \"$CURRENT_VERSION\"/__version__ = \"$NEW_VERSION\"/" stagehand/__init__.py
98+
99+
echo "Updated version to $NEW_VERSION in pyproject.toml and __init__.py"
100+
101+
- name: Commit version bump
102+
run: |
103+
git config --local user.email "action@github.com"
104+
git config --local user.name "GitHub Action"
105+
git add pyproject.toml stagehand/__init__.py
106+
git commit -m "Bump version to ${{ steps.version.outputs.new_version }}"
107+
git tag "v${{ steps.version.outputs.new_version }}"
108+
61109
- name: Build package
62110
run: |
63111
python -m build
@@ -69,10 +117,15 @@ jobs:
69117
run: |
70118
twine upload dist/*
71119
120+
- name: Push version bump
121+
run: |
122+
git push
123+
git push --tags
124+
72125
- name: Create GitHub Release
73126
if: ${{ github.event.inputs.create_release == 'true' }}
74127
uses: softprops/action-gh-release@v1
75128
with:
76-
tag_name: v${{ steps.get_version.outputs.version }}
77-
name: Release v${{ steps.get_version.outputs.version }}
129+
tag_name: v${{ steps.version.outputs.new_version }}
130+
name: Release v${{ steps.version.outputs.new_version }}
78131
generate_release_notes: true

stagehand/browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ async def connect_browserbase_browser(
6464
session = bb.sessions.create(**browserbase_session_create_params)
6565
if not session.id:
6666
raise Exception("Could not create Browserbase session")
67+
stagehand_instance.session_id = session.id
6768
connect_url = session.connectUrl
68-
stagehand_instance.session_id = session.id
6969
except Exception as e:
7070
logger.error(f"Error retrieving or validating Browserbase session: {str(e)}")
7171
raise

stagehand/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ class StagehandConfig(BaseModel):
9898
)
9999
use_api: Optional[bool] = Field(
100100
True,
101-
alias="useAPI",
101+
alias=None,
102102
description="Whether to use the Stagehand API",
103103
)
104104
experimental: Optional[bool] = Field(
105105
False,
106-
alias="experimental",
106+
alias=None,
107107
description="Whether to use experimental features",
108108
)
109109

0 commit comments

Comments
 (0)