Skip to content

Commit 6bbabe5

Browse files
committed
published workflow changes
1 parent c922895 commit 6bbabe5

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,7 @@ jobs:
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"
@@ -66,10 +55,9 @@ PY
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

0 commit comments

Comments
 (0)