91e75e620b
CI: cua-driver distro-compat matrix / Resolve release version (push) Waiting to run
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Blocked by required conditions
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Blocked by required conditions
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Blocked by required conditions
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Blocked by required conditions
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Blocked by required conditions
CI: cua-driver distro-compat matrix / Distro compat summary (push) Blocked by required conditions
CI: Nix Linux Rust source / Nix / compositor build (push) Waiting to run
CI: Nix Linux Rust source / Nix / driver package (push) Waiting to run
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Waiting to run
CI: Rust Linux unit / Rust Linux unit and compile (push) Waiting to run
CI: Rust Windows unit / Rust Windows unit and compile (push) Waiting to run
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Waiting to run
CD: Docs MCP Server / build (linux/amd64) (push) Waiting to run
CD: Docs MCP Server / build (linux/arm64) (push) Waiting to run
CD: Docs MCP Server / merge (push) Blocked by required conditions
167 lines
5.8 KiB
YAML
167 lines
5.8 KiB
YAML
name: "CD: cua-computer (PyPI)"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "computer-v*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to publish (without v prefix)"
|
|
required: true
|
|
default: "0.1.0"
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
description: "Version to publish"
|
|
required: true
|
|
type: string
|
|
|
|
# Adding permissions at workflow level
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: macos-latest
|
|
outputs:
|
|
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: |
|
|
echo "=== Version Detection Debug ==="
|
|
echo "Event name: ${{ github.event_name }}"
|
|
echo "Workflow call version: ${{ inputs.version }}"
|
|
echo "Workflow dispatch version: ${{ github.event.inputs.version }}"
|
|
echo "GitHub ref: ${{ github.ref }}"
|
|
|
|
# Check inputs.version first (works for workflow_call regardless of event_name)
|
|
if [ -n "${{ inputs.version }}" ]; then
|
|
# Version provided via workflow_call or workflow_dispatch with version input
|
|
VERSION=${{ inputs.version }}
|
|
echo "Using inputs.version: $VERSION"
|
|
elif [ "${{ 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]}
|
|
echo "Extracted from tag: $VERSION"
|
|
else
|
|
echo "Invalid tag format for computer"
|
|
exit 1
|
|
fi
|
|
elif [ -n "${{ github.event.inputs.version }}" ]; then
|
|
# Use version from workflow_dispatch event inputs
|
|
VERSION=${{ github.event.inputs.version }}
|
|
echo "Using event.inputs.version: $VERSION"
|
|
else
|
|
echo "ERROR: No version found!"
|
|
echo " - inputs.version is empty"
|
|
echo " - event.inputs.version is empty"
|
|
echo " - Not a tag push event"
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== Final Version ==="
|
|
echo "VERSION=$VERSION"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- 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/python/computer
|
|
# 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
|
|
|
|
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/py-reusable-publish.yml
|
|
with:
|
|
package_name: "computer"
|
|
package_dir: "libs/python/computer"
|
|
version: ${{ needs.prepare.outputs.version }}
|
|
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
|
|
|
|
create-release:
|
|
needs: [prepare, publish]
|
|
uses: ./.github/workflows/release-github-reusable.yml
|
|
with:
|
|
tag_name: "computer-v${{ needs.prepare.outputs.version }}"
|
|
release_name: "cua-computer v${{ needs.prepare.outputs.version }}"
|
|
module_path: "libs/python/computer"
|
|
body: ""
|