File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 - pypi
1616
1717permissions :
18- contents : read
18+ contents : write
19+ id-token : write
1920
2021jobs :
2122 build-and-publish :
2526 - name : Checkout
2627 uses : actions/checkout@v4
2728
29+ - name : Update version from release tag
30+ if : github.event_name == 'release'
31+ run : |
32+ VERSION="${{ github.ref_name }}"
33+ VERSION="${VERSION#v}"
34+ echo "Updating pyproject.toml version to $VERSION"
35+ sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
36+
2837 - name : Setup Node
2938 uses : actions/setup-node@v4
3039 with :
@@ -58,17 +67,13 @@ jobs:
5867
5968 - name : Publish to Test PyPI
6069 if : github.event_name == 'workflow_dispatch' && inputs.publish_to == 'testpypi'
61- env :
62- TWINE_USERNAME : __token__
63- TWINE_PASSWORD : ${{ secrets.TEST_PYPI_TOKEN }}
64- run : twine upload --repository testpypi dist/*
70+ uses : pypa/gh-action-pypi-publish@release/v1
71+ with :
72+ repository-url : https://test.pypi.org/legacy/
6573
6674 - name : Publish to PyPI
6775 if : github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish_to == 'pypi')
68- env :
69- TWINE_USERNAME : __token__
70- TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
71- run : twine upload dist/*
76+ uses : pypa/gh-action-pypi-publish@release/v1
7277
7378 - name : Upload build artifacts
7479 uses : actions/upload-artifact@v4
You can’t perform that action at this time.
0 commit comments