Try with .pypirc setup

This commit is contained in:
Jakob Lass 2025-04-11 15:48:25 +02:00
parent 27edbbbd19
commit 3086ade2fb
2 changed files with 24 additions and 31 deletions

View File

@ -54,36 +54,10 @@ jobs:
- name: Build Wheels
run: |
python -m build .
- name: Write .pypirc file
run: |
python write_pypirc.py ${{secrets.PYPI_TOKEN}}
-name: Upload to PyPI
run: twine upload pipy dist/*
pypi-publish:
name: Upload release to PyPI
needs: [build_wheel]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.13.3]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install twine
- name: Upload
run: |
twine upload --username __token__ --password ${{secrets.PYPI_TOKEN}} --repository https://upload.pypi.org/legacy/ dist/*
# environment:
# name: pypi
# url: https://pypi.org/p/AMBER_ds4ms
# permissions:
# id-token: ${{secrets.PYPI_TOKEN}} # IMPORTANT: this permission is mandatory for trusted publishing
# steps:
# # retrieve your distributions here
#
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1

19
write_pypirc.py Normal file
View File

@ -0,0 +1,19 @@
import sys
def write_file(token):
with open('~/.pypirc','w') as f:
f.writelines(f"""
[distutils]
index-servers =
pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = __token__
password = {token}
""")
if __name__ == "__main__":
token = sys.argv[1]
write_file(token)