Update python-publish.yml #869
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflows will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
# and https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
name: Upload Python Package | |
on: | |
push: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip build | |
pip install setuptools wheel numpy twine | |
- name: Build the package | |
run: | | |
pip install . | |
python -m build | |
- name: Build wheel with cibuildwheel | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
pip install cibuildwheel | |
cibuildwheel --platform linux | |
env: | |
#it is not working with python 3.6, which is outdated and no longer supported by many modern packages, including scikit-build-core. | |
CIBW_SKIP: "cp36-*" | |
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" | |
- name: Publish distribution 📦 to Test PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
twine upload --repository testpypi wheelhouse/* --verbose | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
twine upload wheelhouse/* --verbose | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |