Skip to content

Build and publish to PyPI #37

Build and publish to PyPI

Build and publish to PyPI #37

name: Build and publish to PyPI
on:
release:
types: [created]
jobs:
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade build flake8
- name: Check for syntax errors
run: |
flake8 ./ms2pip --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Build sdist
run: python -m build --sdist --outdir dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: "3.11"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel>=2
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/ms2pip-*.whl
publish-to-pypi:
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}