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 16
16
run : |
17
17
BASE_VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
18
18
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
20
24
21
25
- name : Check if version exists on Test PyPI
22
26
id : version_check
35
39
pip install build
36
40
python -m build
37
41
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
+
38
48
- name : Publish to Test PyPI
39
49
if : steps.version_check.outputs.exists != 'true'
40
50
You can’t perform that action at this time.
0 commit comments