File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838 run : |
3939 TAG="${GITHUB_REF#refs/tags/}"
4040 echo "Git tag: $TAG"
41- python - <<'PY'
42- import pathlib, sys
43- try :
44- import tomllib # Python 3.11+
45- except Exception :
46- import tomli as tomllib # fallback for 3.10
47- data = tomllib.loads(pathlib.Path('pyproject.toml').read_text())
48- version = data['project']['version']
49- print(version)
50- open('project_version.txt','w').write(version)
51- PY
52- VERSION="v$(cat project_version.txt)"
41+ VERSION="v$(python -c "import tomli, pathlib; print(tomli.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")"
5342 echo "Project version: $VERSION"
5443 if [ "$VERSION" != "$TAG" ]; then
5544 echo "::error::Tag $TAG does not match project version $VERSION"
6655
6756 - name : Publish to PyPI
6857 if : startsWith(github.ref, 'refs/tags/')
69- env :
70- TWINE_USERNAME : __token__
71- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
72- run : |
73- twine upload --skip-existing dist/*
58+ uses : pypa/gh-action-pypi-publish@release/v1
59+ with :
60+ password : ${{ secrets.PYPI_API_TOKEN }}
61+ skip-existing : true
7462
7563
You can’t perform that action at this time.
0 commit comments