@@ -18,20 +18,11 @@ jobs:
18
18
python -m pip install --upgrade pip
19
19
pip install -e .
20
20
21
- - name : Set preview version
21
+ - name : Get Hatch version
22
+ id : version
22
23
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
35
26
36
27
- name : Check if version exists on Test PyPI
37
28
id : version_check
@@ -49,23 +40,14 @@ jobs:
49
40
- name : Build package
50
41
if : steps.version_check.outputs.exists != 'true'
51
42
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
62
45
63
46
- name : Publish to Test PyPI
64
47
if : steps.version_check.outputs.exists != 'true'
65
48
66
49
with :
67
50
repository-url : https://test.pypi.org/legacy/
68
- password : ${{ secrets.TEST_PYPI_TOKEN }}
69
51
verbose : true
70
52
71
53
- name : Comment on PR
0 commit comments