mirror of
https://github.com/trycua/computer.git
synced 2026-02-19 12:59:34 -06:00
Fix mcp-server dependencies
This commit is contained in:
99
.github/workflows/publish-mcp-server.yml
vendored
99
.github/workflows/publish-mcp-server.yml
vendored
@@ -19,17 +19,19 @@ on:
|
||||
outputs:
|
||||
version:
|
||||
description: "The version that was published"
|
||||
value: ${{ jobs.determine-version.outputs.version }}
|
||||
value: ${{ jobs.prepare.outputs.version }}
|
||||
|
||||
# Adding permissions at workflow level
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
determine-version:
|
||||
prepare:
|
||||
runs-on: macos-latest
|
||||
outputs:
|
||||
version: ${{ steps.get-version.outputs.version }}
|
||||
agent_version: ${{ steps.update-deps.outputs.agent_version }}
|
||||
computer_version: ${{ steps.update-deps.outputs.computer_version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -54,15 +56,102 @@ jobs:
|
||||
echo "VERSION=$VERSION"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Update dependencies to latest versions
|
||||
id: update-deps
|
||||
run: |
|
||||
cd libs/mcp-server
|
||||
|
||||
# Install required package for PyPI API access
|
||||
pip install requests
|
||||
|
||||
# Create a Python script for PyPI version checking
|
||||
cat > get_latest_versions.py << 'EOF'
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
|
||||
def get_package_version(package_name, fallback="0.1.0"):
|
||||
try:
|
||||
response = requests.get(f'https://pypi.org/pypi/{package_name}/json')
|
||||
print(f"API Response Status for {package_name}: {response.status_code}", file=sys.stderr)
|
||||
|
||||
if response.status_code != 200:
|
||||
print(f"API request failed for {package_name}, using fallback version", file=sys.stderr)
|
||||
return fallback
|
||||
|
||||
data = json.loads(response.text)
|
||||
|
||||
if 'info' not in data:
|
||||
print(f"Missing 'info' key in API response for {package_name}, using fallback version", file=sys.stderr)
|
||||
return fallback
|
||||
|
||||
return data['info']['version']
|
||||
except Exception as e:
|
||||
print(f"Error fetching version for {package_name}: {str(e)}", file=sys.stderr)
|
||||
return fallback
|
||||
|
||||
# Get latest versions
|
||||
print(get_package_version('cua-agent'))
|
||||
print(get_package_version('cua-computer'))
|
||||
EOF
|
||||
|
||||
# Execute the script to get the versions
|
||||
VERSIONS=($(python get_latest_versions.py))
|
||||
LATEST_AGENT=${VERSIONS[0]}
|
||||
LATEST_COMPUTER=${VERSIONS[1]}
|
||||
|
||||
echo "Latest cua-agent version: $LATEST_AGENT"
|
||||
echo "Latest cua-computer version: $LATEST_COMPUTER"
|
||||
|
||||
# Output the versions for the next job
|
||||
echo "agent_version=$LATEST_AGENT" >> $GITHUB_OUTPUT
|
||||
echo "computer_version=$LATEST_COMPUTER" >> $GITHUB_OUTPUT
|
||||
|
||||
# Determine major version for version constraint
|
||||
AGENT_MAJOR=$(echo $LATEST_AGENT | cut -d. -f1)
|
||||
COMPUTER_MAJOR=$(echo $LATEST_COMPUTER | cut -d. -f1)
|
||||
|
||||
NEXT_AGENT_MAJOR=$((AGENT_MAJOR + 1))
|
||||
NEXT_COMPUTER_MAJOR=$((COMPUTER_MAJOR + 1))
|
||||
|
||||
# Update dependencies in pyproject.toml
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# macOS version of sed needs an empty string for -i
|
||||
sed -i '' "s/\"cua-agent\[all\]>=.*,<.*\"/\"cua-agent[all]>=$LATEST_AGENT,<$NEXT_AGENT_MAJOR.0.0\"/" pyproject.toml
|
||||
sed -i '' "s/\"cua-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
|
||||
else
|
||||
# Linux version
|
||||
sed -i "s/\"cua-agent\[all\]>=.*,<.*\"/\"cua-agent[all]>=$LATEST_AGENT,<$NEXT_AGENT_MAJOR.0.0\"/" pyproject.toml
|
||||
sed -i "s/\"cua-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
|
||||
fi
|
||||
|
||||
# Display the updated dependencies
|
||||
echo "Updated dependencies in pyproject.toml:"
|
||||
grep -E "cua-agent|cua-computer" pyproject.toml
|
||||
|
||||
publish:
|
||||
needs: determine-version
|
||||
needs: prepare
|
||||
uses: ./.github/workflows/reusable-publish.yml
|
||||
with:
|
||||
package_name: "mcp-server"
|
||||
package_dir: "libs/mcp-server"
|
||||
version: ${{ needs.determine-version.outputs.version }}
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
is_lume_package: false
|
||||
base_package_name: "cua-mcp-server"
|
||||
make_latest: false
|
||||
secrets:
|
||||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
|
||||
set-env-variables:
|
||||
needs: [prepare, publish]
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Set environment variables for use in other jobs
|
||||
run: |
|
||||
echo "AGENT_VERSION=${{ needs.prepare.outputs.agent_version }}" >> $GITHUB_ENV
|
||||
echo "COMPUTER_VERSION=${{ needs.prepare.outputs.computer_version }}" >> $GITHUB_ENV
|
||||
Reference in New Issue
Block a user