mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
101 lines
2.5 KiB
YAML
101 lines
2.5 KiB
YAML
name: Publish to PyPI
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types: [deployment-tests-passed]
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_tag:
|
|
description: 'Release tag to publish'
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
name: Build packages
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Determine release tag
|
|
id: release
|
|
run: |
|
|
# Priority: workflow_dispatch input > repository_dispatch payload > default branch
|
|
if [ -n "${{ inputs.release_tag }}" ]; then
|
|
echo "tag=${{ inputs.release_tag }}" >> $GITHUB_OUTPUT
|
|
elif [ -n "${{ github.event.client_payload.release_tag }}" ]; then
|
|
echo "tag=${{ github.event.client_payload.release_tag }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "tag=" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.release.outputs.tag || github.ref }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
|
|
- name: Build packages
|
|
run: |
|
|
uv build --all-packages
|
|
rm dist/.gitignore
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
publish:
|
|
name: Publish to PyPI
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/p/crewai
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
with:
|
|
version: "0.8.4"
|
|
python-version: "3.12"
|
|
enable-cache: false
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
|
|
- name: Publish to PyPI
|
|
env:
|
|
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
run: |
|
|
failed=0
|
|
for package in dist/*; do
|
|
if [[ "$package" == *"crewai_devtools"* ]]; then
|
|
echo "Skipping private package: $package"
|
|
continue
|
|
fi
|
|
echo "Publishing $package"
|
|
if ! uv publish "$package"; then
|
|
echo "Failed to publish $package"
|
|
failed=1
|
|
fi
|
|
done
|
|
if [ $failed -eq 1 ]; then
|
|
echo "Some packages failed to publish"
|
|
exit 1
|
|
fi
|