mirror of
https://github.com/trycua/computer.git
synced 2026-01-05 12:59:58 -06:00
135 lines
4.2 KiB
YAML
135 lines
4.2 KiB
YAML
name: Bump Version & Publish
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
service:
|
|
description: "Service/Package to bump"
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- cua-agent
|
|
- cua-computer
|
|
- cua-computer-server
|
|
- cua-core
|
|
- cua-mcp-server
|
|
- cua-som
|
|
- pylume
|
|
bump_type:
|
|
description: "Version bump type"
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- patch
|
|
- minor
|
|
- major
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
bump-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
agent_version: ${{ steps.agent_version.outputs.version }}
|
|
computer_version: ${{ steps.computer_version.outputs.version }}
|
|
steps:
|
|
- name: Set package directory
|
|
id: package
|
|
run: |
|
|
case "${{ inputs.service }}" in
|
|
"cua-agent")
|
|
echo "directory=libs/python/agent" >> $GITHUB_OUTPUT
|
|
;;
|
|
"cua-computer")
|
|
echo "directory=libs/python/computer" >> $GITHUB_OUTPUT
|
|
;;
|
|
"cua-computer-server")
|
|
echo "directory=libs/python/computer-server" >> $GITHUB_OUTPUT
|
|
;;
|
|
"cua-core")
|
|
echo "directory=libs/python/core" >> $GITHUB_OUTPUT
|
|
;;
|
|
"cua-mcp-server")
|
|
echo "directory=libs/python/mcp-server" >> $GITHUB_OUTPUT
|
|
;;
|
|
"cua-som")
|
|
echo "directory=libs/python/som" >> $GITHUB_OUTPUT
|
|
;;
|
|
"pylume")
|
|
echo "directory=libs/python/pylume" >> $GITHUB_OUTPUT
|
|
;;
|
|
*)
|
|
echo "Unknown service: ${{ inputs.service }}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install bump2version
|
|
run: pip install bump2version
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Run bump2version
|
|
run: |
|
|
cd ${{ steps.package.outputs.directory }}
|
|
bump2version ${{ inputs.bump_type }}
|
|
|
|
- name: Also bump cua-agent
|
|
if: ${{ inputs.service == 'cua-computer' }}
|
|
run: |
|
|
cd libs/python/agent
|
|
bump2version ${{ inputs.bump_type }}
|
|
|
|
- name: Capture bumped agent version
|
|
if: ${{ inputs.service == 'cua-agent' || inputs.service == 'cua-computer' }}
|
|
id: agent_version
|
|
run: |
|
|
cd libs/python/agent
|
|
VERSION=$(python -c "import tomllib; from pathlib import Path; data = tomllib.loads(Path('pyproject.toml').read_text()); print(data['project']['version'])")
|
|
echo "Agent version: $VERSION"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Capture bumped computer version
|
|
if: ${{ inputs.service == 'cua-computer' }}
|
|
id: computer_version
|
|
run: |
|
|
cd libs/python/computer
|
|
VERSION=$(python -c "import tomllib; from pathlib import Path; data = tomllib.loads(Path('pyproject.toml').read_text()); print(data['project']['version'])")
|
|
echo "Computer version: $VERSION"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Push changes
|
|
run: |
|
|
git push origin main --follow-tags
|
|
|
|
publish-computer:
|
|
needs: bump-version
|
|
if: ${{ inputs.service == 'cua-computer' }}
|
|
uses: ./.github/workflows/pypi-publish-computer.yml
|
|
with:
|
|
version: ${{ needs.bump-version.outputs.computer_version }}
|
|
secrets: inherit
|
|
|
|
publish-agent:
|
|
needs: [bump-version, publish-computer]
|
|
if: ${{ always() && (inputs.service == 'cua-agent' || inputs.service == 'cua-computer') && needs.bump-version.result == 'success' && (inputs.service == 'cua-agent' || needs.publish-computer.result == 'success') }}
|
|
uses: ./.github/workflows/pypi-publish-agent.yml
|
|
with:
|
|
version: ${{ needs.bump-version.outputs.agent_version }}
|
|
secrets: inherit
|