Move non-python libs to respective directories. Update workflows to use updated directories

This commit is contained in:
Morgan Dean
2025-06-25 16:10:08 -07:00
parent d2874e078f
commit 83499550e3
93 changed files with 704 additions and 704 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ jobs:
- run: uname -a
- run: sudo xcode-select -s /Applications/Xcode_16.app # Swift 6.0
- run: swift test
working-directory: ./libs/lume
working-directory: ./libs/swift/lume
build:
name: Release build
runs-on: macos-15
@@ -29,4 +29,4 @@ jobs:
- run: uname -a
- run: sudo xcode-select -s /Applications/Xcode_16.app # Swift 6.0
- run: swift build --configuration release
working-directory: ./libs/lume
working-directory: ./libs/swift/lume
+109 -109
View File
@@ -3,17 +3,17 @@ name: Publish Agent Package
on:
push:
tags:
- 'agent-v*'
- "agent-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
@@ -30,127 +30,127 @@ jobs:
som_version: ${{ steps.update-deps.outputs.som_version }}
core_version: ${{ steps.update-deps.outputs.core_version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/agent-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/agent-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for agent"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
echo "Invalid tag format for agent"
exit 1
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Update dependencies to latest versions
id: update-deps
run: |
cd libs/agent
# Install required package for PyPI API access
pip install requests
# Create a more robust Python script for PyPI version checking
cat > get_latest_versions.py << 'EOF'
import requests
import json
import sys
- name: Update dependencies to latest versions
id: update-deps
run: |
cd libs/python/agent
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
# Install required package for PyPI API access
pip install requests
# Get latest versions
print(get_package_version('cua-computer'))
print(get_package_version('cua-som'))
print(get_package_version('cua-core'))
EOF
# Execute the script to get the versions
VERSIONS=($(python get_latest_versions.py))
LATEST_COMPUTER=${VERSIONS[0]}
LATEST_SOM=${VERSIONS[1]}
LATEST_CORE=${VERSIONS[2]}
echo "Latest cua-computer version: $LATEST_COMPUTER"
echo "Latest cua-som version: $LATEST_SOM"
echo "Latest cua-core version: $LATEST_CORE"
# Output the versions for the next job
echo "computer_version=$LATEST_COMPUTER" >> $GITHUB_OUTPUT
echo "som_version=$LATEST_SOM" >> $GITHUB_OUTPUT
echo "core_version=$LATEST_CORE" >> $GITHUB_OUTPUT
# Determine major version for version constraint
COMPUTER_MAJOR=$(echo $LATEST_COMPUTER | cut -d. -f1)
SOM_MAJOR=$(echo $LATEST_SOM | cut -d. -f1)
CORE_MAJOR=$(echo $LATEST_CORE | cut -d. -f1)
NEXT_COMPUTER_MAJOR=$((COMPUTER_MAJOR + 1))
NEXT_SOM_MAJOR=$((SOM_MAJOR + 1))
NEXT_CORE_MAJOR=$((CORE_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-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
sed -i '' "s/\"cua-som>=.*,<.*\"/\"cua-som>=$LATEST_SOM,<$NEXT_SOM_MAJOR.0.0\"/" pyproject.toml
sed -i '' "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
else
# Linux version
sed -i "s/\"cua-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
sed -i "s/\"cua-som>=.*,<.*\"/\"cua-som>=$LATEST_SOM,<$NEXT_SOM_MAJOR.0.0\"/" pyproject.toml
sed -i "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
fi
# Display the updated dependencies
echo "Updated dependencies in pyproject.toml:"
grep -E "cua-computer|cua-som|cua-core" pyproject.toml
# Create a more robust 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-computer'))
print(get_package_version('cua-som'))
print(get_package_version('cua-core'))
EOF
# Execute the script to get the versions
VERSIONS=($(python get_latest_versions.py))
LATEST_COMPUTER=${VERSIONS[0]}
LATEST_SOM=${VERSIONS[1]}
LATEST_CORE=${VERSIONS[2]}
echo "Latest cua-computer version: $LATEST_COMPUTER"
echo "Latest cua-som version: $LATEST_SOM"
echo "Latest cua-core version: $LATEST_CORE"
# Output the versions for the next job
echo "computer_version=$LATEST_COMPUTER" >> $GITHUB_OUTPUT
echo "som_version=$LATEST_SOM" >> $GITHUB_OUTPUT
echo "core_version=$LATEST_CORE" >> $GITHUB_OUTPUT
# Determine major version for version constraint
COMPUTER_MAJOR=$(echo $LATEST_COMPUTER | cut -d. -f1)
SOM_MAJOR=$(echo $LATEST_SOM | cut -d. -f1)
CORE_MAJOR=$(echo $LATEST_CORE | cut -d. -f1)
NEXT_COMPUTER_MAJOR=$((COMPUTER_MAJOR + 1))
NEXT_SOM_MAJOR=$((SOM_MAJOR + 1))
NEXT_CORE_MAJOR=$((CORE_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-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
sed -i '' "s/\"cua-som>=.*,<.*\"/\"cua-som>=$LATEST_SOM,<$NEXT_SOM_MAJOR.0.0\"/" pyproject.toml
sed -i '' "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
else
# Linux version
sed -i "s/\"cua-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
sed -i "s/\"cua-som>=.*,<.*\"/\"cua-som>=$LATEST_SOM,<$NEXT_SOM_MAJOR.0.0\"/" pyproject.toml
sed -i "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
fi
# Display the updated dependencies
echo "Updated dependencies in pyproject.toml:"
grep -E "cua-computer|cua-som|cua-core" pyproject.toml
publish:
needs: prepare
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "agent"
package_dir: "libs/agent"
package_dir: "libs/python/agent"
version: ${{ needs.prepare.outputs.version }}
is_lume_package: false
base_package_name: "cua-agent"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
set-env-variables:
needs: [prepare, publish]
runs-on: macos-latest
@@ -159,4 +159,4 @@ jobs:
run: |
echo "COMPUTER_VERSION=${{ needs.prepare.outputs.computer_version }}" >> $GITHUB_ENV
echo "SOM_VERSION=${{ needs.prepare.outputs.som_version }}" >> $GITHUB_ENV
echo "CORE_VERSION=${{ needs.prepare.outputs.core_version }}" >> $GITHUB_ENV
echo "CORE_VERSION=${{ needs.prepare.outputs.core_version }}" >> $GITHUB_ENV
+33 -33
View File
@@ -3,17 +3,17 @@ name: Publish Computer Server Package
on:
push:
tags:
- 'computer-server-v*'
- "computer-server-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
outputs:
@@ -31,50 +31,50 @@ jobs:
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/computer-server-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for computer-server"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/computer-server-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for computer-server"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
publish:
needs: prepare
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "computer-server"
package_dir: "libs/computer-server"
package_dir: "libs/python/computer-server"
version: ${{ needs.prepare.outputs.version }}
is_lume_package: false
base_package_name: "cua-computer-server"
secrets:
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 "COMPUTER_VERSION=${{ needs.prepare.outputs.version }}" >> $GITHUB_ENV
echo "COMPUTER_VERSION=${{ needs.prepare.outputs.version }}" >> $GITHUB_ENV
+91 -91
View File
@@ -3,17 +3,17 @@ name: Publish Computer Package
on:
push:
tags:
- 'computer-v*'
- "computer-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
@@ -28,113 +28,113 @@ jobs:
version: ${{ steps.get-version.outputs.version }}
core_version: ${{ steps.update-deps.outputs.core_version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/computer-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/computer-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for computer"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
echo "Invalid tag format for computer"
exit 1
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Update dependencies to latest versions
id: update-deps
run: |
cd libs/computer/python
# Install required package for PyPI API access
pip install requests
# Create a more robust Python script for PyPI version checking
cat > get_latest_versions.py << 'EOF'
import requests
import json
import sys
- name: Update dependencies to latest versions
id: update-deps
run: |
cd libs/python/computer
# Install required package for PyPI API access
pip install requests
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
# Create a more robust Python script for PyPI version checking
cat > get_latest_versions.py << 'EOF'
import requests
import json
import sys
# Get latest versions
print(get_package_version('cua-core'))
EOF
# Execute the script to get the versions
VERSIONS=($(python get_latest_versions.py))
LATEST_CORE=${VERSIONS[0]}
echo "Latest cua-core version: $LATEST_CORE"
# Output the versions for the next job
echo "core_version=$LATEST_CORE" >> $GITHUB_OUTPUT
# Determine major version for version constraint
CORE_MAJOR=$(echo $LATEST_CORE | cut -d. -f1)
NEXT_CORE_MAJOR=$((CORE_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-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
else
# Linux version
sed -i "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
fi
# Display the updated dependencies
echo "Updated dependencies in pyproject.toml:"
grep -E "cua-core" pyproject.toml
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-core'))
EOF
# Execute the script to get the versions
VERSIONS=($(python get_latest_versions.py))
LATEST_CORE=${VERSIONS[0]}
echo "Latest cua-core version: $LATEST_CORE"
# Output the versions for the next job
echo "core_version=$LATEST_CORE" >> $GITHUB_OUTPUT
# Determine major version for version constraint
CORE_MAJOR=$(echo $LATEST_CORE | cut -d. -f1)
NEXT_CORE_MAJOR=$((CORE_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-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
else
# Linux version
sed -i "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
fi
# Display the updated dependencies
echo "Updated dependencies in pyproject.toml:"
grep -E "cua-core" pyproject.toml
publish:
needs: prepare
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "computer"
package_dir: "libs/computer/python"
package_dir: "libs/python/computer"
version: ${{ needs.prepare.outputs.version }}
is_lume_package: false
base_package_name: "cua-computer"
secrets:
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 "CORE_VERSION=${{ needs.prepare.outputs.core_version }}" >> $GITHUB_ENV
echo "CORE_VERSION=${{ needs.prepare.outputs.core_version }}" >> $GITHUB_ENV
+26 -26
View File
@@ -3,17 +3,17 @@ name: Publish Core Package
on:
push:
tags:
- 'core-v*'
- "core-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
@@ -27,37 +27,37 @@ jobs:
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/core-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/core-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for core"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
echo "Invalid tag format for core"
exit 1
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
publish:
needs: prepare
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "core"
package_dir: "libs/core"
package_dir: "libs/python/core"
version: ${{ needs.prepare.outputs.version }}
is_lume_package: false
base_package_name: "cua-core"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
+41 -41
View File
@@ -3,17 +3,17 @@ name: Publish Notarized Lume
on:
push:
tags:
- 'lume-v*'
- "lume-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to notarize (without v prefix)'
description: "Version to notarize (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to notarize'
description: "Version to notarize"
required: true
type: string
secrets:
@@ -64,7 +64,7 @@ jobs:
- name: Create .release directory
run: mkdir -p .release
- name: Set version
id: set_version
run: |
@@ -82,11 +82,11 @@ jobs:
echo "Error: No version found in tag or input"
exit 1
fi
# Update version in Main.swift
echo "Updating version in Main.swift to $VERSION"
sed -i '' "s/static let current: String = \".*\"/static let current: String = \"$VERSION\"/" libs/lume/src/Main.swift
sed -i '' "s/static let current: String = \".*\"/static let current: String = \"$VERSION\"/" libs/swift/lume/src/Main.swift
# Set output for later steps
echo "version=$VERSION" >> $GITHUB_OUTPUT
@@ -106,34 +106,34 @@ jobs:
# Import certificates
echo $APPLICATION_CERT_BASE64 | base64 --decode > application.p12
echo $INSTALLER_CERT_BASE64 | base64 --decode > installer.p12
# Import certificates silently (minimize output)
security import application.p12 -k build.keychain -P "$CERT_PASSWORD" -T /usr/bin/codesign -T /usr/bin/pkgbuild > /dev/null 2>&1
security import installer.p12 -k build.keychain -P "$CERT_PASSWORD" -T /usr/bin/codesign -T /usr/bin/pkgbuild > /dev/null 2>&1
# Allow codesign to access the certificates (minimal output)
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain > /dev/null 2>&1
# Verify certificates were imported
echo "Verifying signing identities..."
CERT_COUNT=$(security find-identity -v -p codesigning build.keychain | grep -c "Developer ID Application" || echo "0")
INSTALLER_COUNT=$(security find-identity -v build.keychain | grep -c "Developer ID Installer" || echo "0")
if [ "$CERT_COUNT" -eq 0 ]; then
echo "Error: No Developer ID Application certificate found"
security find-identity -v -p codesigning build.keychain
exit 1
fi
if [ "$INSTALLER_COUNT" -eq 0 ]; then
echo "Error: No Developer ID Installer certificate found"
security find-identity -v build.keychain
exit 1
fi
echo "Found $CERT_COUNT Developer ID Application certificate(s) and $INSTALLER_COUNT Developer ID Installer certificate(s)"
echo "All required certificates verified successfully"
# Clean up certificate files
rm application.p12 installer.p12
@@ -147,45 +147,45 @@ jobs:
CERT_APPLICATION_NAME: "Developer ID Application: ${{ secrets.DEVELOPER_NAME }} (${{ secrets.TEAM_ID }})"
CERT_INSTALLER_NAME: "Developer ID Installer: ${{ secrets.DEVELOPER_NAME }} (${{ secrets.TEAM_ID }})"
VERSION: ${{ steps.set_version.outputs.version }}
working-directory: ./libs/lume
working-directory: ./libs/swift/lume
run: |
# Minimal debug information
echo "Starting build process..."
echo "Swift version: $(swift --version | head -n 1)"
echo "Building version: $VERSION"
# Ensure .release directory exists
mkdir -p .release
chmod 755 .release
# Build the project first (redirect verbose output)
echo "Building project..."
swift build --configuration release > build.log 2>&1
echo "Build completed."
# Run the notarization script with LOG_LEVEL env var
chmod +x scripts/build/build-release-notarized.sh
cd scripts/build
LOG_LEVEL=minimal ./build-release-notarized.sh
# Return to the lume directory
cd ../..
# Debug: List what files were actually created
echo "Files in .release directory:"
find .release -type f -name "*.tar.gz" -o -name "*.pkg.tar.gz"
# Get architecture for output filename
ARCH=$(uname -m)
OS_IDENTIFIER="darwin-${ARCH}"
# Output paths for later use
echo "tarball_path=.release/lume-${VERSION}-${OS_IDENTIFIER}.tar.gz" >> $GITHUB_OUTPUT
echo "pkg_path=.release/lume-${VERSION}-${OS_IDENTIFIER}.pkg.tar.gz" >> $GITHUB_OUTPUT
- name: Generate SHA256 Checksums
id: generate_checksums
working-directory: ./libs/lume/.release
working-directory: ./libs/swift/lume/.release
run: |
# Use existing checksums file if it exists, otherwise generate one
if [ -f "checksums.txt" ]; then
@@ -197,31 +197,31 @@ jobs:
shasum -a 256 lume-*.tar.gz >> checksums.txt
echo '```' >> checksums.txt
fi
checksums=$(cat checksums.txt)
echo "checksums<<EOF" >> $GITHUB_OUTPUT
echo "$checksums" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Debug: Show all files in the release directory
echo "All files in release directory:"
ls -la
- name: Create Standard Version Releases
working-directory: ./libs/lume/.release
working-directory: ./libs/swift/lume/.release
run: |
VERSION=${{ steps.set_version.outputs.version }}
ARCH=$(uname -m)
OS_IDENTIFIER="darwin-${ARCH}"
# Create OS-tagged symlinks
ln -sf "lume-${VERSION}-${OS_IDENTIFIER}.tar.gz" "lume-darwin.tar.gz"
ln -sf "lume-${VERSION}-${OS_IDENTIFIER}.pkg.tar.gz" "lume-darwin.pkg.tar.gz"
# Create simple symlinks
ln -sf "lume-${VERSION}-${OS_IDENTIFIER}.tar.gz" "lume.tar.gz"
ln -sf "lume-${VERSION}-${OS_IDENTIFIER}.pkg.tar.gz" "lume.pkg.tar.gz"
# List all files (including symlinks)
echo "Files with symlinks in release directory:"
ls -la
@@ -230,14 +230,14 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: lume-notarized-tarball
path: ./libs/lume/${{ steps.build_notarize.outputs.tarball_path }}
path: ./libs/swift/lume/${{ steps.build_notarize.outputs.tarball_path }}
if-no-files-found: error
- name: Upload Notarized Package (Installer)
uses: actions/upload-artifact@v4
with:
name: lume-notarized-installer
path: ./libs/lume/${{ steps.build_notarize.outputs.pkg_path }}
path: ./libs/swift/lume/${{ steps.build_notarize.outputs.pkg_path }}
if-no-files-found: error
- name: Create Release
@@ -245,18 +245,18 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
./libs/lume/${{ steps.build_notarize.outputs.tarball_path }}
./libs/lume/${{ steps.build_notarize.outputs.pkg_path }}
./libs/lume/.release/lume-darwin.tar.gz
./libs/lume/.release/lume-darwin.pkg.tar.gz
./libs/lume/.release/lume.tar.gz
./libs/lume/.release/lume.pkg.tar.gz
./libs/swift/lume/${{ steps.build_notarize.outputs.tarball_path }}
./libs/swift/lume/${{ steps.build_notarize.outputs.pkg_path }}
./libs/swift/lume/.release/lume-darwin.tar.gz
./libs/swift/lume/.release/lume-darwin.pkg.tar.gz
./libs/swift/lume/.release/lume.tar.gz
./libs/swift/lume/.release/lume.pkg.tar.gz
body: |
${{ steps.generate_checksums.outputs.checksums }}
### Installation with script
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/swift/lume/scripts/install.sh)"
```
generate_release_notes: true
make_latest: true
make_latest: true
+102 -102
View File
@@ -3,17 +3,17 @@ name: Publish MCP Server Package
on:
push:
tags:
- 'mcp-server-v*'
- "mcp-server-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
outputs:
@@ -33,120 +33,120 @@ jobs:
agent_version: ${{ steps.update-deps.outputs.agent_version }}
computer_version: ${{ steps.update-deps.outputs.computer_version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/mcp-server-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/mcp-server-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for mcp-server"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
echo "Invalid tag format for mcp-server"
exit 1
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- 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
- name: Update dependencies to latest versions
id: update-deps
run: |
cd libs/python/mcp-server
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
# Install required package for PyPI API access
pip install requests
# 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
# Update cua-agent with all extras
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
# 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
# Update cua-agent with all extras
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: prepare
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "mcp-server"
package_dir: "libs/mcp-server"
package_dir: "libs/python/mcp-server"
version: ${{ needs.prepare.outputs.version }}
is_lume_package: false
base_package_name: "cua-mcp-server"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
set-env-variables:
needs: [prepare, publish]
runs-on: macos-latest
@@ -154,4 +154,4 @@ jobs:
- 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
echo "COMPUTER_VERSION=${{ needs.prepare.outputs.computer_version }}" >> $GITHUB_ENV
+36 -36
View File
@@ -3,17 +3,17 @@ name: Publish Pylume Package
on:
push:
tags:
- 'pylume-v*'
- "pylume-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
outputs:
@@ -31,52 +31,52 @@ jobs:
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/pylume-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/pylume-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for pylume"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
echo "Invalid tag format for pylume"
exit 1
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
validate-version:
runs-on: macos-latest
needs: determine-version
steps:
- uses: actions/checkout@v4
- name: Validate version
id: validate-version
run: |
CODE_VERSION=$(grep '__version__' libs/pylume/pylume/__init__.py | cut -d'"' -f2)
if [ "${{ needs.determine-version.outputs.version }}" != "$CODE_VERSION" ]; then
echo "Version mismatch: expected $CODE_VERSION, got ${{ needs.determine-version.outputs.version }}"
exit 1
fi
echo "Version validated: $CODE_VERSION"
- uses: actions/checkout@v4
- name: Validate version
id: validate-version
run: |
CODE_VERSION=$(grep '__version__' libs/python/pylume/pylume/__init__.py | cut -d'"' -f2)
if [ "${{ needs.determine-version.outputs.version }}" != "$CODE_VERSION" ]; then
echo "Version mismatch: expected $CODE_VERSION, got ${{ needs.determine-version.outputs.version }}"
exit 1
fi
echo "Version validated: $CODE_VERSION"
publish:
needs: determine-version
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "pylume"
package_dir: "libs/pylume"
package_dir: "libs/python/pylume"
version: ${{ needs.determine-version.outputs.version }}
is_lume_package: true
base_package_name: "pylume"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
+26 -26
View File
@@ -3,17 +3,17 @@ name: Publish SOM Package
on:
push:
tags:
- 'som-v*'
- "som-v*"
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without v prefix)'
description: "Version to publish (without v prefix)"
required: true
default: '0.1.0'
default: "0.1.0"
workflow_call:
inputs:
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
outputs:
@@ -31,37 +31,37 @@ jobs:
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/som-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
if [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/som-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Invalid tag format for som"
exit 1
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
echo "Invalid tag format for som"
exit 1
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use version from workflow dispatch
VERSION=${{ github.event.inputs.version }}
else
# Use version from workflow_call
VERSION=${{ inputs.version }}
fi
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
publish:
needs: determine-version
uses: ./.github/workflows/reusable-publish.yml
with:
package_name: "som"
package_dir: "libs/som"
package_dir: "libs/python/som"
version: ${{ needs.determine-version.outputs.version }}
is_lume_package: false
base_package_name: "cua-som"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
+238 -238
View File
@@ -4,28 +4,28 @@ on:
workflow_call:
inputs:
package_name:
description: 'Name of the package (e.g. pylume, computer, agent)'
description: "Name of the package (e.g. pylume, computer, agent)"
required: true
type: string
package_dir:
description: 'Directory containing the package relative to workspace root (e.g. libs/pylume)'
description: "Directory containing the package relative to workspace root (e.g. libs/python/pylume)"
required: true
type: string
version:
description: 'Version to publish'
description: "Version to publish"
required: true
type: string
is_lume_package:
description: 'Whether this package includes the lume binary'
description: "Whether this package includes the lume binary"
required: false
type: boolean
default: false
base_package_name:
description: 'PyPI package name (e.g. pylume, cua-agent)'
description: "PyPI package name (e.g. pylume, cua-agent)"
required: true
type: string
make_latest:
description: 'Whether to mark this release as latest (should only be true for lume)'
description: "Whether to mark this release as latest (should only be true for lume)"
required: false
type: boolean
default: false
@@ -41,240 +41,240 @@ jobs:
build-and-publish:
runs-on: macos-latest
permissions:
contents: write # This permission is needed for creating releases
contents: write # This permission is needed for creating releases
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for release creation
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Create root pdm.lock file
run: |
# Create an empty pdm.lock file in the root
touch pdm.lock
- name: Install PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: '3.11'
cache: true
- name: Set version
id: set-version
run: |
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for release creation
- name: Initialize PDM in package directory
run: |
# Make sure we're working with a properly initialized PDM project
cd ${{ inputs.package_dir }}
# Create pdm.lock if it doesn't exist
if [ ! -f "pdm.lock" ]; then
echo "No pdm.lock found, initializing PDM project..."
pdm lock
fi
- name: Set version in package
run: |
cd ${{ inputs.package_dir }}
# Replace pdm bump with direct edit of pyproject.toml
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS version of sed needs an empty string for -i
sed -i '' "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml
else
# Linux version
sed -i "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml
fi
# Verify version was updated
echo "Updated version in pyproject.toml:"
grep "version =" pyproject.toml
# Conditional step for lume binary download (only for pylume package)
- name: Download and setup lume binary
if: inputs.is_lume_package
run: |
# Create a temporary directory for extraction
mkdir -p temp_lume
# Download the latest lume release directly
echo "Downloading latest lume version..."
curl -sL "https://github.com/trycua/lume/releases/latest/download/lume.tar.gz" -o temp_lume/lume.tar.gz
# Extract the tar file (ignore ownership and suppress warnings)
cd temp_lume && tar --no-same-owner -xzf lume.tar.gz
# Make the binary executable
chmod +x lume
# Copy the lume binary to the correct location in the pylume package
mkdir -p "${GITHUB_WORKSPACE}/${{ inputs.package_dir }}/pylume"
cp lume "${GITHUB_WORKSPACE}/${{ inputs.package_dir }}/pylume/lume"
# Verify the binary exists and is executable
test -x "${GITHUB_WORKSPACE}/${{ inputs.package_dir }}/pylume/lume" || { echo "lume binary not found or not executable"; exit 1; }
# Get the version from the downloaded binary for reference
LUME_VERSION=$(./lume --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
echo "Using lume version: $LUME_VERSION"
# Cleanup
cd "${GITHUB_WORKSPACE}" && rm -rf temp_lume
# Save the lume version for reference
echo "LUME_VERSION=${LUME_VERSION}" >> $GITHUB_ENV
- name: Build and publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
cd ${{ inputs.package_dir }}
# Build with PDM
pdm build
# For pylume package, verify the binary is in the wheel
if [ "${{ inputs.is_lume_package }}" = "true" ]; then
python -m pip install wheel
wheel unpack dist/*.whl --dest temp_wheel
echo "Listing contents of wheel directory:"
find temp_wheel -type f
test -f temp_wheel/pylume-*/pylume/lume || { echo "lume binary not found in wheel"; exit 1; }
rm -rf temp_wheel
echo "Publishing ${{ inputs.base_package_name }} ${VERSION} with lume ${LUME_VERSION}"
else
echo "Publishing ${{ inputs.base_package_name }} ${VERSION}"
fi
# Install and use twine directly instead of PDM publish
echo "Installing twine for direct publishing..."
pip install twine
echo "Publishing to PyPI using twine..."
TWINE_USERNAME="__token__" TWINE_PASSWORD="$PYPI_TOKEN" python -m twine upload dist/*
# Save the wheel file path for the release
WHEEL_FILE=$(ls dist/*.whl | head -1)
echo "WHEEL_FILE=${WHEEL_FILE}" >> $GITHUB_ENV
- name: Prepare Simple Release Notes
if: startsWith(github.ref, 'refs/tags/')
run: |
# Create release notes based on package type
echo "# ${{ inputs.base_package_name }} v${VERSION}" > release_notes.md
echo "" >> release_notes.md
if [ "${{ inputs.package_name }}" = "pylume" ]; then
echo "## Python SDK for lume - run macOS and Linux VMs on Apple Silicon" >> release_notes.md
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Create root pdm.lock file
run: |
# Create an empty pdm.lock file in the root
touch pdm.lock
- name: Install PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.11"
cache: true
- name: Set version
id: set-version
run: |
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
- name: Initialize PDM in package directory
run: |
# Make sure we're working with a properly initialized PDM project
cd ${{ inputs.package_dir }}
# Create pdm.lock if it doesn't exist
if [ ! -f "pdm.lock" ]; then
echo "No pdm.lock found, initializing PDM project..."
pdm lock
fi
- name: Set version in package
run: |
cd ${{ inputs.package_dir }}
# Replace pdm bump with direct edit of pyproject.toml
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS version of sed needs an empty string for -i
sed -i '' "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml
else
# Linux version
sed -i "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml
fi
# Verify version was updated
echo "Updated version in pyproject.toml:"
grep "version =" pyproject.toml
# Conditional step for lume binary download (only for pylume package)
- name: Download and setup lume binary
if: inputs.is_lume_package
run: |
# Create a temporary directory for extraction
mkdir -p temp_lume
# Download the latest lume release directly
echo "Downloading latest lume version..."
curl -sL "https://github.com/trycua/lume/releases/latest/download/lume.tar.gz" -o temp_lume/lume.tar.gz
# Extract the tar file (ignore ownership and suppress warnings)
cd temp_lume && tar --no-same-owner -xzf lume.tar.gz
# Make the binary executable
chmod +x lume
# Copy the lume binary to the correct location in the pylume package
mkdir -p "${GITHUB_WORKSPACE}/${{ inputs.package_dir }}/pylume"
cp lume "${GITHUB_WORKSPACE}/${{ inputs.package_dir }}/pylume/lume"
# Verify the binary exists and is executable
test -x "${GITHUB_WORKSPACE}/${{ inputs.package_dir }}/pylume/lume" || { echo "lume binary not found or not executable"; exit 1; }
# Get the version from the downloaded binary for reference
LUME_VERSION=$(./lume --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
echo "Using lume version: $LUME_VERSION"
# Cleanup
cd "${GITHUB_WORKSPACE}" && rm -rf temp_lume
# Save the lume version for reference
echo "LUME_VERSION=${LUME_VERSION}" >> $GITHUB_ENV
- name: Build and publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
cd ${{ inputs.package_dir }}
# Build with PDM
pdm build
# For pylume package, verify the binary is in the wheel
if [ "${{ inputs.is_lume_package }}" = "true" ]; then
python -m pip install wheel
wheel unpack dist/*.whl --dest temp_wheel
echo "Listing contents of wheel directory:"
find temp_wheel -type f
test -f temp_wheel/pylume-*/pylume/lume || { echo "lume binary not found in wheel"; exit 1; }
rm -rf temp_wheel
echo "Publishing ${{ inputs.base_package_name }} ${VERSION} with lume ${LUME_VERSION}"
else
echo "Publishing ${{ inputs.base_package_name }} ${VERSION}"
fi
# Install and use twine directly instead of PDM publish
echo "Installing twine for direct publishing..."
pip install twine
echo "Publishing to PyPI using twine..."
TWINE_USERNAME="__token__" TWINE_PASSWORD="$PYPI_TOKEN" python -m twine upload dist/*
# Save the wheel file path for the release
WHEEL_FILE=$(ls dist/*.whl | head -1)
echo "WHEEL_FILE=${WHEEL_FILE}" >> $GITHUB_ENV
- name: Prepare Simple Release Notes
if: startsWith(github.ref, 'refs/tags/')
run: |
# Create release notes based on package type
echo "# ${{ inputs.base_package_name }} v${VERSION}" > release_notes.md
echo "" >> release_notes.md
echo "This package provides Python bindings for the lume virtualization tool." >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* lume binary: v${LUME_VERSION}" >> release_notes.md
elif [ "${{ inputs.package_name }}" = "computer" ]; then
echo "## Computer control library for the Computer Universal Automation (CUA) project" >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* pylume: ${PYLUME_VERSION:-latest}" >> release_notes.md
elif [ "${{ inputs.package_name }}" = "agent" ]; then
echo "## Dependencies" >> release_notes.md
echo "* cua-computer: ${COMPUTER_VERSION:-latest}" >> release_notes.md
echo "* cua-som: ${SOM_VERSION:-latest}" >> release_notes.md
echo "" >> release_notes.md
echo "## Installation Options" >> release_notes.md
echo "" >> release_notes.md
echo "### Basic installation with Anthropic" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install cua-agent[anthropic]==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "### With SOM (recommended)" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install cua-agent[som]==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "### All features" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install cua-agent[all]==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
elif [ "${{ inputs.package_name }}" = "som" ]; then
echo "## Computer Vision and OCR library for detecting and analyzing UI elements" >> release_notes.md
echo "" >> release_notes.md
echo "This package provides enhanced UI understanding capabilities through computer vision and OCR." >> release_notes.md
elif [ "${{ inputs.package_name }}" = "computer-server" ]; then
echo "## Computer Server for the Computer Universal Automation (CUA) project" >> release_notes.md
echo "" >> release_notes.md
echo "A FastAPI-based server implementation for computer control." >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* cua-computer: ${COMPUTER_VERSION:-latest}" >> release_notes.md
echo "" >> release_notes.md
echo "## Usage" >> release_notes.md
echo '```bash' >> release_notes.md
echo "# Run the server" >> release_notes.md
echo "cua-computer-server" >> release_notes.md
echo '```' >> release_notes.md
elif [ "${{ inputs.package_name }}" = "mcp-server" ]; then
echo "## MCP Server for the Computer-Use Agent (CUA)" >> release_notes.md
echo "" >> release_notes.md
echo "This package provides MCP (Model Context Protocol) integration for CUA agents, allowing them to be used with Claude Desktop, Cursor, and other MCP clients." >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* cua-computer: ${COMPUTER_VERSION:-latest}" >> release_notes.md
echo "* cua-agent: ${AGENT_VERSION:-latest}" >> release_notes.md
echo "" >> release_notes.md
echo "## Usage" >> release_notes.md
echo '```bash' >> release_notes.md
echo "# Run the MCP server directly" >> release_notes.md
echo "cua-mcp-server" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "## Claude Desktop Integration" >> release_notes.md
echo "Add to your Claude Desktop configuration (~/.config/claude-desktop/claude_desktop_config.json or OS-specific location):" >> release_notes.md
echo '```json' >> release_notes.md
echo '"mcpServers": {' >> release_notes.md
echo ' "cua-agent": {' >> release_notes.md
echo ' "command": "cua-mcp-server",' >> release_notes.md
echo ' "args": [],' >> release_notes.md
echo ' "env": {' >> release_notes.md
echo ' "CUA_AGENT_LOOP": "OMNI",' >> release_notes.md
echo ' "CUA_MODEL_PROVIDER": "ANTHROPIC",' >> release_notes.md
echo ' "CUA_MODEL_NAME": "claude-3-opus-20240229",' >> release_notes.md
echo ' "ANTHROPIC_API_KEY": "your-api-key",' >> release_notes.md
echo ' "PYTHONIOENCODING": "utf-8"' >> release_notes.md
echo ' }' >> release_notes.md
echo ' }' >> release_notes.md
echo '}' >> release_notes.md
echo '```' >> release_notes.md
fi
# Add installation section if not agent (which has its own installation section)
if [ "${{ inputs.package_name }}" != "agent" ]; then
echo "" >> release_notes.md
echo "## Installation" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install ${{ inputs.base_package_name }}==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
fi
echo "Release notes created:"
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: "${{ inputs.base_package_name }} v${{ env.VERSION }}"
body_path: release_notes.md
files: ${{ inputs.package_dir }}/${{ env.WHEEL_FILE }}
draft: false
prerelease: false
make_latest: ${{ inputs.package_name == 'lume' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if [ "${{ inputs.package_name }}" = "pylume" ]; then
echo "## Python SDK for lume - run macOS and Linux VMs on Apple Silicon" >> release_notes.md
echo "" >> release_notes.md
echo "This package provides Python bindings for the lume virtualization tool." >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* lume binary: v${LUME_VERSION}" >> release_notes.md
elif [ "${{ inputs.package_name }}" = "computer" ]; then
echo "## Computer control library for the Computer Universal Automation (CUA) project" >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* pylume: ${PYLUME_VERSION:-latest}" >> release_notes.md
elif [ "${{ inputs.package_name }}" = "agent" ]; then
echo "## Dependencies" >> release_notes.md
echo "* cua-computer: ${COMPUTER_VERSION:-latest}" >> release_notes.md
echo "* cua-som: ${SOM_VERSION:-latest}" >> release_notes.md
echo "" >> release_notes.md
echo "## Installation Options" >> release_notes.md
echo "" >> release_notes.md
echo "### Basic installation with Anthropic" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install cua-agent[anthropic]==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "### With SOM (recommended)" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install cua-agent[som]==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "### All features" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install cua-agent[all]==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
elif [ "${{ inputs.package_name }}" = "som" ]; then
echo "## Computer Vision and OCR library for detecting and analyzing UI elements" >> release_notes.md
echo "" >> release_notes.md
echo "This package provides enhanced UI understanding capabilities through computer vision and OCR." >> release_notes.md
elif [ "${{ inputs.package_name }}" = "computer-server" ]; then
echo "## Computer Server for the Computer Universal Automation (CUA) project" >> release_notes.md
echo "" >> release_notes.md
echo "A FastAPI-based server implementation for computer control." >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* cua-computer: ${COMPUTER_VERSION:-latest}" >> release_notes.md
echo "" >> release_notes.md
echo "## Usage" >> release_notes.md
echo '```bash' >> release_notes.md
echo "# Run the server" >> release_notes.md
echo "cua-computer-server" >> release_notes.md
echo '```' >> release_notes.md
elif [ "${{ inputs.package_name }}" = "mcp-server" ]; then
echo "## MCP Server for the Computer-Use Agent (CUA)" >> release_notes.md
echo "" >> release_notes.md
echo "This package provides MCP (Model Context Protocol) integration for CUA agents, allowing them to be used with Claude Desktop, Cursor, and other MCP clients." >> release_notes.md
echo "" >> release_notes.md
echo "## Dependencies" >> release_notes.md
echo "* cua-computer: ${COMPUTER_VERSION:-latest}" >> release_notes.md
echo "* cua-agent: ${AGENT_VERSION:-latest}" >> release_notes.md
echo "" >> release_notes.md
echo "## Usage" >> release_notes.md
echo '```bash' >> release_notes.md
echo "# Run the MCP server directly" >> release_notes.md
echo "cua-mcp-server" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "## Claude Desktop Integration" >> release_notes.md
echo "Add to your Claude Desktop configuration (~/.config/claude-desktop/claude_desktop_config.json or OS-specific location):" >> release_notes.md
echo '```json' >> release_notes.md
echo '"mcpServers": {' >> release_notes.md
echo ' "cua-agent": {' >> release_notes.md
echo ' "command": "cua-mcp-server",' >> release_notes.md
echo ' "args": [],' >> release_notes.md
echo ' "env": {' >> release_notes.md
echo ' "CUA_AGENT_LOOP": "OMNI",' >> release_notes.md
echo ' "CUA_MODEL_PROVIDER": "ANTHROPIC",' >> release_notes.md
echo ' "CUA_MODEL_NAME": "claude-3-opus-20240229",' >> release_notes.md
echo ' "ANTHROPIC_API_KEY": "your-api-key",' >> release_notes.md
echo ' "PYTHONIOENCODING": "utf-8"' >> release_notes.md
echo ' }' >> release_notes.md
echo ' }' >> release_notes.md
echo '}' >> release_notes.md
echo '```' >> release_notes.md
fi
# Add installation section if not agent (which has its own installation section)
if [ "${{ inputs.package_name }}" != "agent" ]; then
echo "" >> release_notes.md
echo "## Installation" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install ${{ inputs.base_package_name }}==${VERSION}" >> release_notes.md
echo '```' >> release_notes.md
fi
echo "Release notes created:"
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: "${{ inputs.base_package_name }} v${{ env.VERSION }}"
body_path: release_notes.md
files: ${{ inputs.package_dir }}/${{ env.WHEEL_FILE }}
draft: false
prerelease: false
make_latest: ${{ inputs.package_name == 'lume' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}