name: Nightly Canary Release on: schedule: - cron: '0 6 * * *' # daily at 6am UTC workflow_dispatch: jobs: check: name: Check for new commits runs-on: ubuntu-latest permissions: contents: read outputs: has_changes: ${{ steps.check.outputs.has_changes }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check for recent commits id: check run: | # 25h window absorbs cron-vs-commit timing skew at the boundary. RECENT=$(git log --since="25 hours ago" --oneline | head -1) if [ -n "$RECENT" ]; then echo "has_changes=true" >> "$GITHUB_OUTPUT" else echo "has_changes=false" >> "$GITHUB_OUTPUT" fi build: name: Build nightly packages needs: check if: needs.check.outputs.has_changes == 'true' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: read steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v6 with: version: "0.11.3" python-version: "3.12" enable-cache: false - name: Stamp nightly versions run: | DATE=$(date +%Y%m%d) # All workspace packages share the same base version and are released together. BASE=$(python -c " import re print(re.search(r'__version__\s*=\s*\"(.*?)\"', open('lib/crewai/src/crewai/__init__.py').read()).group(1)) ") NIGHTLY="${BASE}.dev${DATE}" echo "Nightly version: ${NIGHTLY}" for init_file in \ lib/crewai/src/crewai/__init__.py \ lib/crewai-core/src/crewai_core/__init__.py \ lib/crewai-tools/src/crewai_tools/__init__.py \ lib/crewai-files/src/crewai_files/__init__.py \ lib/cli/src/crewai_cli/__init__.py; do sed -i "s/__version__ = .*/__version__ = \"${NIGHTLY}\"/" "$init_file" echo "Stamped $init_file -> $NIGHTLY" done # Update all cross-package dependency pins to the nightly version. sed -i "s/\"crewai==[^\"]*\"/\"crewai==${NIGHTLY}\"/" lib/crewai-tools/pyproject.toml sed -i "s/\"crewai-core==[^\"]*\"/\"crewai-core==${NIGHTLY}\"/" lib/crewai/pyproject.toml sed -i "s/\"crewai-cli==[^\"]*\"/\"crewai-cli==${NIGHTLY}\"/" lib/crewai/pyproject.toml sed -i "s/\"crewai-tools==[^\"]*\"/\"crewai-tools==${NIGHTLY}\"/" lib/crewai/pyproject.toml sed -i "s/\"crewai-files==[^\"]*\"/\"crewai-files==${NIGHTLY}\"/" lib/crewai/pyproject.toml sed -i "s/\"crewai-core==[^\"]*\"/\"crewai-core==${NIGHTLY}\"/" lib/cli/pyproject.toml echo "Updated cross-package dependency pins to ${NIGHTLY}" - 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 nightly 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.11.3" 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