Files
firecrawl/.github/workflows/publish-python-sdk.yml
capy-ai[bot] 604eb26e3f ci: show a release summary and supersede unapproved release runs (#5413)
* ci: show a release summary before release approval

* ci: run the Elixir release summary from the repository root

* ci: supersede release runs still waiting for approval

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-11-02 22:07:15 +01:00

136 lines
4.3 KiB
YAML

name: Publish Python SDK
on:
push:
branches:
- main
paths:
- 'apps/python-sdk/**'
permissions: {}
jobs:
build:
name: Build
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: read
outputs:
publish: ${{ steps.version_check.outputs.publish }}
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.x'
- name: Install build tools
run: |
python -m pip install --no-cache-dir -r .github/pip-bootstrap.txt
python -m pip install build==1.6.1 requests==2.34.2 packaging==26.3
- name: Run version check script
id: version_check
run: |
VERSION_INCREMENTED=$(python .github/scripts/check_version_has_incremented.py python ./apps/python-sdk/firecrawl firecrawl-py)
echo "publish=$VERSION_INCREMENTED" >> "$GITHUB_OUTPUT"
- name: Build firecrawl-py and firecrawl
if: steps.version_check.outputs.publish == 'true'
working-directory: ./apps/python-sdk
run: |
python -m build --outdir "$RUNNER_TEMP/dist/firecrawl-py"
sed -i 's/name = "firecrawl-py"/name = "firecrawl"/g' pyproject.toml
sed -i 's/name="firecrawl-py"/name="firecrawl"/g' setup.py
rm -rf build *.egg-info
python -m build --outdir "$RUNNER_TEMP/dist/firecrawl"
ls -lR "$RUNNER_TEMP/dist"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: steps.version_check.outputs.publish == 'true'
with:
name: python-sdk-dist
path: ${{ runner.temp }}/dist
if-no-files-found: error
retention-days: 7
supersede:
name: Supersede unapproved runs
needs: build
if: needs.build.outputs.publish == 'true' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
continue-on-error: true
with:
sparse-checkout: .github/actions
persist-credentials: false
- uses: ./.github/actions/supersede-waiting-runs
continue-on-error: true
timeout-minutes: 2
release-summary:
name: Release summary
needs: build
if: needs.build.outputs.publish == 'true' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
pull-requests: read
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
continue-on-error: true
with:
fetch-depth: 0
filter: blob:none
persist-credentials: false
- name: Read the version
id: version
continue-on-error: true
run: |
echo "version=$(sed -nE "s/^__version__ = ['\"]([^'\"]+)['\"].*/\1/p" apps/python-sdk/firecrawl/__init__.py)" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/release-summary
continue-on-error: true
timeout-minutes: 3
with:
gated-job: Publish to PyPI
version: firecrawl-py and firecrawl ${{ steps.version.outputs.version }}
paths: apps/python-sdk
publish:
name: Publish to PyPI
needs: [build, release-summary]
if: needs.build.outputs.publish == 'true' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: release
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref }}
cancel-in-progress: false
permissions:
id-token: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: python-sdk-dist
path: dist
- name: Publish firecrawl-py
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
packages-dir: dist/firecrawl-py/
attestations: true
- name: Publish firecrawl
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
packages-dir: dist/firecrawl/
attestations: true