@@ -21,12 +21,14 @@ jobs:
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
26- uses : actions/checkout@v4
28+ uses : actions/checkout@v6
2729
2830 - name : Set up Python
29- uses : actions/setup-python@v5
31+ uses : actions/setup-python@v6
3032 with :
3133 python-version : " 3.14"
3234
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
47- uses : actions/upload-artifact@v4
67+ uses : actions/upload-artifact@v7
4868 with :
4969 name : dist-files
5070 path : dist/
@@ -56,12 +76,12 @@ jobs:
5676 needs : build
5777 steps :
5878 - name : Set up Python
59- uses : actions/setup-python@v5
79+ uses : actions/setup-python@v6
6080 with :
6181 python-version : " 3.14"
6282
6383 - name : Download dist files
64- uses : actions/download-artifact@v4
84+ uses : actions/download-artifact@v8
6585 with :
6686 name : dist-files
6787 path : dist/
94114 id-token : write # IMPORTANT: mandatory for trusted publishing
95115 steps :
96116 - name : Download dist files
97- uses : actions/download-artifact@v4
117+ uses : actions/download-artifact@v8
98118 with :
99119 name : dist-files
100120 path : dist/
@@ -118,7 +138,7 @@ jobs:
118138 id-token : write # IMPORTANT: mandatory for trusted publishing
119139 steps :
120140 - name : Download dist files
121- uses : actions/download-artifact@v4
141+ uses : actions/download-artifact@v8
122142 with :
123143 name : dist-files
124144 path : dist/
@@ -133,20 +153,26 @@ 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/'))
140160 steps :
141161 - name : Set up Python
142- uses : actions/setup-python@v5
162+ uses : actions/setup-python@v6
143163 with :
144164 python-version : " 3.14"
145165
166+ - name : Checkout repository for actions
167+ uses : actions/checkout@v6
168+
169+ - name : Wait for version to be available on TestPyPI (30 seconds)
170+ run : sleep 30
171+
146172 - name : Install from TestPyPI
147173 run : |
148174 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]
175+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ " GridDataFormats[test]==${{ needs.build.outputs.version }}"
150176
151177 - name : Test import
152178 run : |
@@ -163,20 +189,26 @@ jobs:
163189 fail-fast : false
164190 matrix :
165191 os : [ubuntu-latest, macos-latest]
166- needs : deploy-pypi
192+ needs : [build, deploy-pypi]
167193 if : |
168194 github.repository == 'MDAnalysis/GridDataFormats' &&
169195 (github.event_name == 'release' && github.event.action == 'published')
170196 steps :
171197 - name : Set up Python
172- uses : actions/setup-python@v5
198+ uses : actions/setup-python@v6
173199 with :
174200 python-version : " 3.14"
175201
202+ - name : Checkout repository for actions
203+ uses : actions/checkout@v6
204+
205+ - name : Wait for version to be available on PyPI (30 seconds)
206+ run : sleep 30
207+
176208 - name : Install from PyPI
177209 run : |
178210 python -m pip install --upgrade pip
179- pip install GridDataFormats[test]
211+ pip install " GridDataFormats[test]==${{ needs.build.outputs.version }}"
180212
181213 - name : Test import
182214 run : |
0 commit comments