Skip to content

Commit

Permalink
pypi publish workflow (#101)
Browse files Browse the repository at this point in the history
* New try publish to pypi

* Continue with new tests
  • Loading branch information
marco-2023 authored Feb 8, 2025
1 parent c330e3a commit 7e1efb0
Showing 1 changed file with 50 additions and 19 deletions.
69 changes: 50 additions & 19 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,57 @@ jobs:
echo "Contents of wheelhouse:"
ls -l wheelhouse/
- name: Upload to PyPI
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
${{ matrix.buildplat[2] }} ${{ matrix.buildplat[3] }}
${{ matrix.buildplat[4] }}

publish-to-pypi:
name: Publish Python distribution to PyPI
# only publish to PyPI on tag pushes
if: startsWith(github.ref, 'refs/tags/')
needs:
- build_wheels
runs-on: ubuntu-latest
environment:
name: pypi-release
url: https://pypi.org/project/${{ env.PYPI_NAME }}
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
if [ "$(ls -A wheelhouse)" ]; then
python -m pip install --upgrade twine
python -m twine upload --repository-url https://upload.pypi.org/legacy/ wheelhouse/*
else
echo "No wheel files to upload"
fi

- name: Upload to TestPyPI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
if [ "$(ls -A wheelhouse)" ]; then
python -m pip install --upgrade twine
python -m twine upload --repository-url https://test.pypi.org/legacy/ wheelhouse/*
else
echo "No wheel files to upload"
fi
# - name: Upload to PyPI
# env:
# TWINE_USERNAME: "__token__"
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: |
# if [ "$(ls -A wheelhouse)" ]; then
# python -m pip install --upgrade twine
# python -m twine upload --repository-url https://upload.pypi.org/legacy/ wheelhouse/*
# else
# echo "No wheel files to upload"
# fi

# - name: Upload to TestPyPI
# env:
# TWINE_USERNAME: "__token__"
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
# run: |
# if [ "$(ls -A wheelhouse)" ]; then
# python -m pip install --upgrade twine
# python -m twine upload --repository-url https://test.pypi.org/legacy/ wheelhouse/*
# else
# echo "No wheel files to upload"
# fi

0 comments on commit 7e1efb0

Please sign in to comment.