Files
trycua--cua/.github/workflows/cd-py-computer-server.yml
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:03:19 +08:00

143 lines
4.7 KiB
YAML

name: "CD: cua-computer-server (PyPI)"
on:
push:
tags:
- "computer-server-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
outputs:
version:
description: "The version that was published"
value: ${{ jobs.prepare.outputs.version }}
# Adding permissions at workflow level
permissions:
contents: write
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
# Check inputs.version first (set by workflow_call)
if [ -n "${{ inputs.version }}" ]; then
VERSION=${{ inputs.version }}
elif [ "${{ 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
echo "No version provided"
exit 1
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/py-reusable-publish.yml
with:
package_name: "computer-server"
package_dir: "libs/python/computer-server"
version: ${{ needs.prepare.outputs.version }}
base_package_name: "cua-computer-server"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
build-binaries:
needs: prepare
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: cua-computer-server-linux-x86_64
zip_name: cua-computer-server-linux-x86_64.tar.gz
dir_name: cua-computer-server
- os: windows-latest
artifact_name: cua-computer-server-windows-x86_64
zip_name: cua-computer-server-windows-x86_64.zip
dir_name: cua-computer-server
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install pyinstaller
pip install -e libs/python/computer-server
- name: Build binary with PyInstaller (onedir — fast startup)
run: |
cd libs/python/computer-server
pyinstaller --onedir --name "${{ matrix.dir_name }}" --console --noconfirm --clean --collect-all computer_server --hidden-import uvicorn.logging --hidden-import uvicorn.protocols.http --hidden-import uvicorn.protocols.http.auto --hidden-import uvicorn.protocols.http.h11_impl --hidden-import uvicorn.protocols.websockets --hidden-import uvicorn.protocols.websockets.auto --hidden-import uvicorn.lifespan --hidden-import uvicorn.lifespan.on --hidden-import PIL._tkinter_finder run_server.py
- name: Create archive (Linux)
if: runner.os == 'Linux'
run: |
cd libs/python/computer-server/dist
tar czf "${{ matrix.zip_name }}" "${{ matrix.dir_name }}"/
- name: Create archive (Windows)
if: runner.os == 'Windows'
run: |
cd libs/python/computer-server/dist
7z a "${{ matrix.zip_name }}" "${{ matrix.dir_name }}/"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: libs/python/computer-server/dist/${{ matrix.zip_name }}
set-env-variables:
needs: [prepare, publish]
runs-on: ubuntu-latest
steps:
- name: Set environment variables for use in other jobs
run: |
echo "COMPUTER_VERSION=${{ needs.prepare.outputs.version }}" >> $GITHUB_ENV
create-release:
needs: [prepare, publish, build-binaries]
uses: ./.github/workflows/release-github-reusable.yml
with:
tag_name: "computer-server-v${{ needs.prepare.outputs.version }}"
release_name: "cua-computer-server v${{ needs.prepare.outputs.version }}"
module_path: "libs/python/computer-server"
body: ""
attach_artifacts: true