4646 build-and-publish :
4747 needs : test
4848 runs-on : ubuntu-latest
49- # Only run this job on release creation or tag push
5049 if : github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v')
5150
5251 steps :
@@ -60,53 +59,54 @@ jobs:
6059 - name : Install dependencies
6160 run : |
6261 python -m pip install --upgrade pip
63- pip install build twine
64- pip install -e .
62+ pip install -e .[dev]
6563
6664 - name : Generate models
6765 run : |
6866 python scripts/generate_models.py
67+ echo "Generated $(find msgspec_schemaorg/models -type f -name "*.py" | wc -l) model files"
6968
7069 - name : Build package
7170 run : |
71+ # Build the package
7272 python -m build
73+
74+ # Verify package contents
75+ echo "Verifying package contents..."
76+
77+ # Check source distribution
78+ mkdir -p /tmp/check-sdist
79+ tar -xf dist/*.tar.gz -C /tmp/check-sdist
80+ MODEL_COUNT=$(find /tmp/check-sdist -name "*.py" | grep models | wc -l)
81+ echo "Source distribution contains $MODEL_COUNT model files"
82+ if [ "$MODEL_COUNT" -lt 900 ]; then
83+ echo "ERROR: Not enough model files in source distribution"
84+ exit 1
85+ fi
86+
87+ # Install and verify the wheel
88+ pip install dist/*.whl
89+ python -c "import msgspec_schemaorg.models; count = len(msgspec_schemaorg.models.__all__); print(f'Wheel contains {count} importable models'); assert count > 900, 'Not enough models'"
7390
74- - name : Upload package distributions
91+ - name : Upload distributions
7592 uses : actions/upload-artifact@v4
7693 with :
7794 name : python-package-distributions
7895 path : dist/
7996
8097 - name : Publish to PyPI
81- if : github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v')
8298 uses : pypa/gh-action-pypi-publish@release/v1
8399 with :
84- user : __token__
85100 password : ${{ secrets.PYPI_API_TOKEN }}
86101 skip-existing : true
87102
88- - name : Sign the dists with Sigstore
103+ - name : Sign with Sigstore
89104 uses : sigstore/gh-action-sigstore-python@v3.0.0
90105 with :
91- inputs : >-
92- ./dist/*.tar.gz
93- ./dist/*.whl
106+ inputs : ./dist/*.tar.gz ./dist/*.whl
94107
95- - name : Create GitHub Release
96- env :
97- GITHUB_TOKEN : ${{ github.token }}
98- run : >-
99- gh release create
100- "$GITHUB_REF_NAME"
101- --repo "$GITHUB_REPOSITORY"
102- --notes "This release was automatically created by the GitHub Actions workflow."
103- - name : Upload artifact signatures to GitHub Release
108+ - name : Upload to GitHub Release
104109 env :
105110 GITHUB_TOKEN : ${{ github.token }}
106- # Upload to GitHub Release using the `gh` CLI.
107- # `dist/` contains the built packages, and the
108- # sigstore-produced signatures and certificates.
109- run : >-
110- gh release upload
111- "$GITHUB_REF_NAME" dist/**
112- --repo "$GITHUB_REPOSITORY"
111+ run : |
112+ gh release upload "$GITHUB_REF_NAME" dist/** --repo "$GITHUB_REPOSITORY"
0 commit comments