@@ -902,19 +902,43 @@ jobs:
902902
903903 - run : uv sync --only-group build
904904
905+ - name : Extract pydantic-core version
906+ id : core-version
907+ run : |
908+ VERSION=$(cargo metadata --format-version 1 --no-deps --frozen --quiet --offline --manifest-path pydantic-core/Cargo.toml | jq -r '.packages[0].version')
909+ echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
910+ echo "pydantic-core version: $VERSION"
911+
912+ - name : Check if pydantic-core version is already on PyPI
913+ id : check-pypi
914+ run : |
915+ STATUS=$(curl -s -o /dev/null -I -w "%{http_code}" https://pypi.org/pypi/pydantic-core/${STEPS_CORE_VERSION_OUTPUTS_VERSION}/json)
916+ if [ "$STATUS" = "200" ]; then
917+ echo "already_published=true" >> "$GITHUB_OUTPUT"
918+ echo "pydantic-core ${STEPS_CORE_VERSION_OUTPUTS_VERSION} is already on PyPI, skipping publish"
919+ else
920+ echo "already_published=false" >> "$GITHUB_OUTPUT"
921+ echo "pydantic-core ${STEPS_CORE_VERSION_OUTPUTS_VERSION} not found on PyPI, will publish"
922+ fi
923+ env :
924+ STEPS_CORE_VERSION_OUTPUTS_VERSION : ${{ steps.core-version.outputs.VERSION }}
925+
905926 - name : Get pydantic-core dist artifacts
927+ if : steps.check-pypi.outputs.already_published != 'true'
906928 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
907929 with :
908930 pattern : pydantic_core_pypi_files_*
909931 merge-multiple : true
910932 path : pydantic-core-dist
911933
912934 - name : Test pydantic-core wheels integrity
935+ if : steps.check-pypi.outputs.already_published != 'true'
913936 run : |
914937 for whl in pydantic-core-dist/*.whl; do unzip -qt "$whl"; done
915938 uv run --no-sync twine check --strict pydantic-core-dist/*
916939
917940 - name : Publish pydantic-core to PyPI
941+ if : steps.check-pypi.outputs.already_published != 'true'
918942 run : uv publish --trusted-publishing always pydantic-core-dist/*
919943
920944 release-pydantic :
@@ -936,6 +960,8 @@ jobs:
936960 with :
937961 enable-cache : false
938962
963+ - run : uv sync --only-group build
964+
939965 - name : Get pydantic dist artifacts
940966 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
941967 with :
0 commit comments