File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,28 @@ jobs:
15
15
- name : Set preview version
16
16
run : |
17
17
BASE_VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
18
- echo "VERSION=${BASE_VERSION}.dev${GITHUB_PR_NUMBER}" >> $GITHUB_ENV
18
+ SHORT_SHA=$(git rev-parse --short HEAD)
19
+ echo "VERSION=${BASE_VERSION}.dev${GITHUB_PR_NUMBER}+${SHORT_SHA}" >> $GITHUB_ENV
20
+
21
+ - name : Check if version exists on Test PyPI
22
+ id : version_check
23
+ run : |
24
+ if pip index versions --index-url https://test.pypi.org/simple/ socketsecurity | grep -q "${VERSION}"; then
25
+ echo "Version ${VERSION} already exists on Test PyPI"
26
+ echo "exists=true" >> $GITHUB_OUTPUT
27
+ else
28
+ echo "Version ${VERSION} not found on Test PyPI"
29
+ echo "exists=false" >> $GITHUB_OUTPUT
30
+ fi
19
31
20
32
- name : Build package
33
+ if : steps.version_check.outputs.exists != 'true'
21
34
run : |
22
35
pip install build
23
36
python -m build
24
37
25
38
- name : Publish to Test PyPI
39
+ if : steps.version_check.outputs.exists != 'true'
26
40
27
41
with :
28
42
repository-url : https://test.pypi.org/legacy/
You can’t perform that action at this time.
0 commit comments