Skip to content

Build and Upload to PyPI #10

Build and Upload to PyPI

Build and Upload to PyPI #10

Workflow file for this run

name: Build and Upload to PyPI
on:
push:
tags:
- 'v*'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools cython twine
- name: Build wheel
working-directory: ./datamule
run: |
python setup.py bdist_wheel
- name: Store wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: datamule/dist/*.whl
upload_pypi:
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install auditwheel wheel setuptools cython twine
- name: Download all wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: datamule/dist
- name: Fix Linux wheels
if: runner.os == 'Linux'
working-directory: ./datamule
run: |
for whl in dist/*linux*.whl; do
if [ -f "$whl" ]; then
auditwheel repair "$whl" --plat manylinux2014_x86_64
rm "$whl"
fi
done
if [ -d "wheelhouse" ]; then
mv wheelhouse/* dist/
rmdir wheelhouse
fi
- name: Build source distribution
working-directory: ./datamule
run: python setup.py sdist
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
working-directory: ./datamule
run: |
twine upload dist/*