mirror of
https://github.com/trycua/computer.git
synced 2026-01-04 04:19:57 -06:00
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: Publish Computer Server Package
|
|
|
|
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: macos-latest
|
|
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
|
|
|
|
- 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"
|
|
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 |