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+ # This is a bit dirty; running in a virtual environment would be cleaner.
57+ # (pip install only works because our package's dependencies are easy to install.)
58+ python -m pip install --upgrade pip
59+ pip install "$WHEEL_FILE" --quiet
60+ VERSION=$(python -c "import gridData; print(gridData.__version__)")
61+ pip uninstall -y griddataformats --quiet
62+ fi
63+ echo "version=$VERSION" >> $GITHUB_OUTPUT
64+ echo "Extracted version: $VERSION"
65+
4666 - name : Upload dist files
4767 uses : actions/upload-artifact@v4
4868 with :
@@ -133,7 +153,7 @@ jobs:
133153 fail-fast : false
134154 matrix :
135155 os : [ubuntu-latest, macos-latest]
136- needs : deploy-testpypi
156+ needs : [build, deploy-testpypi]
137157 if : |
138158 github.repository == 'MDAnalysis/GridDataFormats' &&
139159 (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
@@ -143,10 +163,17 @@ jobs:
143163 with :
144164 python-version : " 3.14"
145165
166+ - name : Wait for version to be available on TestPyPI
167+ uses : ./.github/actions/wait-for-pypi-version
168+ with :
169+ repository : testpypi
170+ package : GridDataFormats
171+ version : ${{ needs.build.outputs.version }}
172+
146173 - name : Install from TestPyPI
147174 run : |
148175 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]
176+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ " GridDataFormats==${{ needs.build.outputs.version }} [test]"
150177
151178 - name : Test import
152179 run : |
@@ -163,7 +190,7 @@ jobs:
163190 fail-fast : false
164191 matrix :
165192 os : [ubuntu-latest, macos-latest]
166- needs : deploy-pypi
193+ needs : [build, deploy-pypi]
167194 if : |
168195 github.repository == 'MDAnalysis/GridDataFormats' &&
169196 (github.event_name == 'release' && github.event.action == 'published')
@@ -173,10 +200,17 @@ jobs:
173200 with :
174201 python-version : " 3.14"
175202
203+ - name : Wait for version to be available on PyPI
204+ uses : ./.github/actions/wait-for-pypi-version
205+ with :
206+ repository : pypi
207+ package : GridDataFormats
208+ version : ${{ needs.build.outputs.version }}
209+
176210 - name : Install from PyPI
177211 run : |
178212 python -m pip install --upgrade pip
179- pip install GridDataFormats[test]
213+ pip install " GridDataFormats==${{ needs.build.outputs.version }} [test]"
180214
181215 - name : Test import
182216 run : |
0 commit comments