@@ -18,20 +18,11 @@ jobs:
1818 python -m pip install --upgrade pip
1919 pip install -e .
2020
21- - name : Set preview version
21+ - name : Get Hatch version
22+ id : version
2223 run : |
23- BASE_VERSION=$(python -c "from socketsecurity import __version__; print(__version__)")
24- PREVIEW_VERSION="${BASE_VERSION}.dev${{ github.event.pull_request.number }}${{ github.event.pull_request.commits }}"
25- echo "VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV
26-
27- # Update version in __init__.py
28- echo "__version__ = \"${PREVIEW_VERSION}\"" > socketsecurity/__init__.py.tmp
29- cat socketsecurity/__init__.py | grep -v "__version__" >> socketsecurity/__init__.py.tmp
30- mv socketsecurity/__init__.py.tmp socketsecurity/__init__.py
31-
32- # Verify the change
33- echo "Updated version in __init__.py:"
34- python -c "from socketsecurity import __version__; print(__version__)"
24+ VERSION=$(hatch version)
25+ echo "VERSION=$VERSION" >> $GITHUB_ENV
3526
3627 - name : Check if version exists on Test PyPI
3728 id : version_check
@@ -49,23 +40,14 @@ jobs:
4940 - name : Build package
5041 if : steps.version_check.outputs.exists != 'true'
5142 run : |
52- pip install build
53- python -m build
54-
55- - name : Restore original version
56- if : always()
57- run : |
58- BASE_VERSION=$(echo $VERSION | cut -d'.' -f1-3)
59- echo "__version__ = \"${BASE_VERSION}\"" > socketsecurity/__init__.py.tmp
60- cat socketsecurity/__init__.py | grep -v "__version__" >> socketsecurity/__init__.py.tmp
61- mv socketsecurity/__init__.py.tmp socketsecurity/__init__.py
43+ pip install hatchling
44+ hatch build
6245
6346 - name : Publish to Test PyPI
6447 if : steps.version_check.outputs.exists != 'true'
6548 uses : pypa/gh-action-pypi-publish@v1.8.11
6649 with :
6750 repository-url : https://test.pypi.org/legacy/
68- password : ${{ secrets.TEST_PYPI_TOKEN }}
6951 verbose : true
7052
7153 - name : Comment on PR
0 commit comments