2024-06-07 00:49:22 +08:00
|
|
|
name: Publish Python SDK
|
2024-06-06 21:53:55 +08:00
|
|
|
|
|
|
|
on:
|
2024-06-06 22:04:14 +08:00
|
|
|
pull_request:
|
2024-06-06 21:53:55 +08:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
env:
|
|
|
|
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
|
|
|
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-publish:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install setuptools wheel twine build requests packaging
|
|
|
|
|
2024-06-06 22:21:45 +08:00
|
|
|
- name: Run version check script
|
|
|
|
id: version_check_script
|
|
|
|
run: |
|
|
|
|
VERSION_INCREMENTED=$(python .github/scripts/check_version_has_incremented.py python ./apps/python-sdk/firecrawl firecrawl-py)
|
|
|
|
echo "VERSION_INCREMENTED=$VERSION_INCREMENTED" >> $GITHUB_ENV
|
2024-06-06 21:53:55 +08:00
|
|
|
|
2024-06-06 22:38:16 +08:00
|
|
|
- name: Build the package
|
|
|
|
if: ${{ env.VERSION_INCREMENTED == 'true' }}
|
|
|
|
run: |
|
|
|
|
python -m build
|
2024-06-06 22:43:44 +08:00
|
|
|
working-directory: ./apps/python-sdk
|
2024-06-06 22:38:16 +08:00
|
|
|
|
|
|
|
- name: Publish to PyPI
|
|
|
|
if: ${{ env.VERSION_INCREMENTED == 'true' }}
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
|
|
run: |
|
2024-06-07 00:27:31 +08:00
|
|
|
twine upload dist/*
|
|
|
|
working-directory: ./apps/python-sdk
|
|
|
|
|