Skip to content

Commit 914ebe5

Browse files
committed
update workflow
1 parent ee69673 commit 914ebe5

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

.github/workflows/python-workflow.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,19 @@ jobs:
3737
- name: Test with pytest
3838
run: |
3939
pytest
40+
4041
- name: Build
4142
if: startsWith(github.ref, 'refs/tags/v') && matrix.python-version == env.PRIMARY_PYTHON_VERSION
4243
run: |
4344
python -m build
45+
TAG_VERSION=${{ github.ref_name }}
46+
TAG_VERSION=${TAG_VERSION#v}
47+
WHL_VERSION=$(unzip -p dist/*.whl '*/METADATA' | grep '^Version:' | awk '{print $2}')
48+
WHL_VERSION=${WHL_VERSION#v}
49+
if [ "$TAG_VERSION" != "$WHL_VERSION" ]; then
50+
echo "Version mismatch: Git tag version ($TAG_VERSION) does not match wheel version ($WHL_VERSION)"
51+
exit 1
52+
fi
4453
- name: Save artifacts
4554
if: startsWith(github.ref, 'refs/tags/v') && matrix.python-version == env.PRIMARY_PYTHON_VERSION
4655
uses: actions/upload-artifact@v4
@@ -86,7 +95,7 @@ jobs:
8695
- name: Install dependencies
8796
run: |
8897
python -m pip install --upgrade pip
89-
pip install "${{ env.PYPI_PACKAGE_NAME }}[dev]" --extra-index-url https://test.pypi.org/simple/
98+
pip install "${{ env.PYPI_PACKAGE_NAME }}[dev]" -i https://test.pypi.org/simple/
9099
- name: Test with pytest
91100
run: |
92101
pytest
@@ -96,7 +105,7 @@ jobs:
96105
runs-on: ubuntu-latest
97106
needs: test-from-test-pypi
98107
environment:
99-
name: testpypi
108+
name: pypi
100109
url: https://pypi.org/p/${{ env.PYPI_PACKAGE_NAME }}
101110
permissions:
102111
id-token: write
@@ -106,16 +115,6 @@ jobs:
106115
with:
107116
name: python-package-distributions
108117
path: dist/
109-
- name: Validate version
110-
run: |
111-
TAG_VERSION=${{ github.ref_name }}
112-
TAG_VERSION=${TAG_VERSION#v}
113-
WHL_VERSION=$(unzip -p dist/*.whl '*/METADATA' | grep '^Version:' | awk '{print $2}')
114-
WHL_VERSION=${WHL_VERSION#v}
115-
if [ "$TAG_VERSION" != "$WHL_VERSION" ]; then
116-
echo "Version mismatch: Git tag version ($TAG_VERSION) does not match wheel version ($WHL_VERSION)"
117-
exit 1
118-
fi
119118
- name: Create GitHub Release
120119
env:
121120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)