2121 build :
2222 name : Build package
2323 runs-on : ubuntu-latest
24+ outputs :
25+ version : ${{ steps.extract-version.outputs.version }}
2426 steps :
2527 - name : Checkout
2628 uses : actions/checkout@v4
4345 run : |
4446 twine check dist/*
4547
48+ - name : Extract package version
49+ id : extract-version
50+ run : |
51+ WHEEL_FILE=$(ls dist/*.whl)
52+ # Extract version from wheel filename (format: GridDataFormats-VERSION-py3-none-any.whl)
53+ VERSION=$(basename "$WHEEL_FILE" | sed -n 's/GridDataFormats-\([^-]*\)-.*/\1/p')
54+ # Fallback: install wheel temporarily and get version
55+ if [ -z "$VERSION" ]; then
56+ pip install "$WHEEL_FILE" --quiet
57+ VERSION=$(python -c "import gridData; print(gridData.__version__)")
58+ pip uninstall -y GridDataFormats --quiet
59+ fi
60+ echo "version=$VERSION" >> $GITHUB_OUTPUT
61+ echo "Extracted version: $VERSION"
62+
4663 - name : Upload dist files
4764 uses : actions/upload-artifact@v4
4865 with :
@@ -133,7 +150,7 @@ jobs:
133150 fail-fast : false
134151 matrix :
135152 os : [ubuntu-latest, macos-latest]
136- needs : deploy-testpypi
153+ needs : [build, deploy-testpypi]
137154 if : |
138155 github.repository == 'MDAnalysis/GridDataFormats' &&
139156 (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
@@ -143,10 +160,17 @@ jobs:
143160 with :
144161 python-version : " 3.14"
145162
163+ - name : Wait for version to be available on TestPyPI
164+ uses : ./.github/actions/wait-for-pypi-version
165+ with :
166+ repository : testpypi
167+ package : GridDataFormats
168+ version : ${{ needs.build.outputs.version }}
169+
146170 - name : Install from TestPyPI
147171 run : |
148172 python -m pip install --upgrade pip
149- pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ GridDataFormats[test]
173+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ " GridDataFormats==${{ needs.build.outputs.version }} [test]"
150174
151175 - name : Test import
152176 run : |
@@ -163,7 +187,7 @@ jobs:
163187 fail-fast : false
164188 matrix :
165189 os : [ubuntu-latest, macos-latest]
166- needs : deploy-pypi
190+ needs : [build, deploy-pypi]
167191 if : |
168192 github.repository == 'MDAnalysis/GridDataFormats' &&
169193 (github.event_name == 'release' && github.event.action == 'published')
@@ -173,10 +197,17 @@ jobs:
173197 with :
174198 python-version : " 3.14"
175199
200+ - name : Wait for version to be available on PyPI
201+ uses : ./.github/actions/wait-for-pypi-version
202+ with :
203+ repository : pypi
204+ package : GridDataFormats
205+ version : ${{ needs.build.outputs.version }}
206+
176207 - name : Install from PyPI
177208 run : |
178209 python -m pip install --upgrade pip
179- pip install GridDataFormats[test]
210+ pip install " GridDataFormats==${{ needs.build.outputs.version }} [test]"
180211
181212 - name : Test import
182213 run : |
0 commit comments