99
1010permissions :
1111 contents : read
12- # id-token: write # No longer needed when using API tokens
12+ # id-token: write # Not needed when using API tokens
1313
1414jobs :
1515 build :
2121 - name : Set up Python
2222 uses : actions/setup-python@v5
2323 with :
24- python-version : ' 3.x' # Use a version compatible with requires-python
24+ python-version : ' 3.x'
2525
2626 - name : Install PEP 517 build dependencies
2727 run : >-
@@ -41,14 +41,18 @@ jobs:
4141 - name : Inspect Wheel Metadata
4242 run : |
4343 WHEEL_FILE=$(find dist/ -name '*.whl')
44+ echo "--- METADATA from $WHEEL_FILE ---"
4445 unzip -p "$WHEEL_FILE" "*.dist-info/METADATA" || echo "METADATA file not found in wheel"
46+ echo "-----------------------------------"
4547
4648 # Inspect the PKG-INFO file within the generated sdist (tar.gz)
4749 - name : Inspect Sdist PKG-INFO
4850 run : |
4951 SDIST_FILE=$(find dist/ -name '*.tar.gz')
52+ echo "--- PKG-INFO from $SDIST_FILE ---"
5053 # Extract only the PKG-INFO file to stdout
5154 tar -xOzf "$SDIST_FILE" "*/PKG-INFO" 2>/dev/null || echo "PKG-INFO file not found in sdist"
55+ echo "----------------------------------"
5256
5357 - name : Store the distribution packages
5458 uses : actions/upload-artifact@v4
@@ -60,11 +64,11 @@ jobs:
6064 name : Publish to TestPyPI
6165 needs : build
6266 runs-on : ubuntu-latest
63- if : github.event_name == 'push' && github.ref == 'refs/heads/main' # Publish to TestPyPI on pushes to main
67+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
6468
6569 environment :
6670 name : testpypi
67- url : https://test.pypi.org/p/syscoin-address-converter # Optional: link to TestPyPI project
71+ url : https://test.pypi.org/p/syscoin-address-converter
6872
6973 steps :
7074 - name : Download all the dists
@@ -73,23 +77,24 @@ jobs:
7377 name : python-package-distributions
7478 path : dist/
7579
80+ - name : Install twine
81+ run : python -m pip install twine
82+
7683 - name : Publish distribution to TestPyPI
77- uses : pypa/gh-action-pypi-publish@release/v1
78- with :
79- repository-url : https://test.pypi.org/legacy/
80- # Use trusted publishing (recommended) - OIDC is likely default
81- # Alternatively, use a token:
82- password : ${{ secrets.TEST_PYPI_API_TOKEN }}
84+ env :
85+ TWINE_USERNAME : __token__
86+ TWINE_PASSWORD : ${{ secrets.TEST_PYPI_API_TOKEN }}
87+ run : python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
8388
8489 publish-to-pypi :
8590 name : Publish to PyPI
8691 needs : build
8792 runs-on : ubuntu-latest
88- if : github.event_name == 'release' && github.event.action == 'published' # Publish to PyPI on release
93+ if : github.event_name == 'release' && github.event.action == 'published'
8994
9095 environment :
9196 name : pypi
92- url : https://pypi.org/p/syscoin-address-converter # Optional: link to PyPI project
97+ url : https://pypi.org/p/syscoin-address-converter
9398
9499 steps :
95100 - name : Download all the dists
@@ -98,11 +103,11 @@ jobs:
98103 name : python-package-distributions
99104 path : dist/
100105
106+ - name : Install twine
107+ run : python -m pip install twine
108+
101109 - name : Publish distribution to PyPI
102- uses : pypa/gh-action-pypi-publish@release/v1
103- # Use trusted publishing (recommended)
104- # Requires configuring trusted publishers in PyPI project settings
105- # https://docs.pypi.org/trusted-publishers/
106- # Alternatively, use a token:
107- with :
108- password : ${{ secrets.PYPI_API_TOKEN }}
110+ env :
111+ TWINE_USERNAME : __token__
112+ TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
113+ run : python -m twine upload dist/*
0 commit comments