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:
1515 - name : Set preview version
1616 run : |
1717 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
1931
2032 - name : Build package
33+ if : steps.version_check.outputs.exists != 'true'
2134 run : |
2235 pip install build
2336 python -m build
2437
2538 - name : Publish to Test PyPI
39+ if : steps.version_check.outputs.exists != 'true'
2640 uses : pypa/gh-action-pypi-publish@v1.8.11
2741 with :
2842 repository-url : https://test.pypi.org/legacy/
You can’t perform that action at this time.
0 commit comments