44 release :
55 types :
66 - published
7+ workflow_dispatch :
78
89jobs :
910 build :
1415 - uses : actions/checkout@v4
1516 with :
1617 persist-credentials : false
18+ fetch-depth : 0 # Required for dynamic versioning
1719
1820 - name : Install python
1921 uses : actions/setup-python@v5
@@ -56,11 +58,38 @@ jobs:
5658 uses : pypa/gh-action-pypi-publish@release/v1
5759 with :
5860 repository-url : https://test.pypi.org/legacy/
61+ skip-existing : true # Prevents failure on re-runs
62+
63+ verify-testpypi :
64+ name : Verify TestPyPI Install 🕵️
65+ needs : publish-to-testpypi
66+ runs-on : ubuntu-latest
67+ steps :
68+ - uses : actions/setup-python@v5
69+ with :
70+ python-version : " 3.12"
71+
72+ - name : Wait for TestPyPI indexing
73+ run : sleep 60
74+
75+ - name : Install from TestPyPI
76+ # --extra-index-url allows pip to find dependencies (pandas, numpy) on the real PyPI
77+ if : github.event_name == 'release'
78+ run : pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "DoubleML==${{ github.ref_name }}"
79+
80+ - name : Install from TestPyPI (workflow_dispatch)
81+ # For manual runs, install the latest pre-release version
82+ if : github.event_name == 'workflow_dispatch'
83+ run : pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ DoubleML
84+
85+ - name : Import Smoke Test
86+ run : python -c "import doubleml; print(f'Successfully imported DoubleML version {doubleml.__version__}')"
5987
6088 publish-to-pypi :
6189 name : Publish to PyPI 🚀
62- needs : publish-to -testpypi
90+ needs : verify -testpypi
6391 runs-on : ubuntu-latest
92+ if : github.event_name == 'release' # Do not publish on workflow_dispatch
6493 environment :
6594 name : pypi
6695 url : https://pypi.org/p/DoubleML
@@ -76,3 +105,22 @@ jobs:
76105
77106 - name : Publish to PyPI
78107 uses : pypa/gh-action-pypi-publish@release/v1
108+
109+ verify-pypi :
110+ name : Verify PyPI Install 🕵️
111+ needs : publish-to-pypi
112+ runs-on : ubuntu-latest
113+ if : github.event_name == 'release'
114+ steps :
115+ - uses : actions/setup-python@v5
116+ with :
117+ python-version : " 3.12"
118+
119+ - name : Wait for PyPI indexing
120+ run : sleep 60
121+
122+ - name : Install from PyPI
123+ run : pip install "DoubleML==${{ github.ref_name }}"
124+
125+ - name : Import Smoke Test
126+ run : python -c "import doubleml; print(f'Successfully imported DoubleML version {doubleml.__version__}')"
0 commit comments