File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1616 run : |
1717 BASE_VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
1818 SHORT_SHA=$(git rev-parse --short HEAD)
19- echo "VERSION=${BASE_VERSION}.dev${GITHUB_PR_NUMBER}+${SHORT_SHA}" >> $GITHUB_ENV
19+ PREVIEW_VERSION="${BASE_VERSION}.dev${GITHUB_PR_NUMBER}+${SHORT_SHA}"
20+ echo "VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV
21+
22+ # Temporarily update the version in __init__.py
23+ sed -i "s/__version__ = \"${BASE_VERSION}\"/__version__ = \"${PREVIEW_VERSION}\"/" socketsecurity/__init__.py
2024
2125 - name : Check if version exists on Test PyPI
2226 id : version_check
3539 pip install build
3640 python -m build
3741
42+ - name : Restore original version
43+ if : always() # Run even if previous steps fail
44+ run : |
45+ BASE_VERSION=$(echo $VERSION | cut -d'.' -f1-3)
46+ sed -i "s/__version__ = \"${VERSION}\"/__version__ = \"${BASE_VERSION}\"/" socketsecurity/__init__.py
47+
3848 - name : Publish to Test PyPI
3949 if : steps.version_check.outputs.exists != 'true'
4050
You can’t perform that action at this time.
0 commit comments