Skip to content

Build and publish

Build and publish #48

Workflow file for this run

name: Build and publish
on:
push:
tags:
- 'v*'
jobs:
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Create and publish source distribution
run: |
python -m build --sdist .
python3 -m twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
macos-wheels:
runs-on: macos-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, 3.10]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build wheel and publish
run: |
python -m build --wheel .
python3 -m twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
linux-wheels:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
strategy:
matrix:
python-version: [cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: /opt/python/${{ matrix.python-version }}/bin/python -m pip install build twine
- name: Build wheel
run: /opt/python/${{ matrix.python-version }}/bin/python -m build --wheel .
- name: Run auditwheel for manylinux wheel
run: auditwheel repair -w dist dist/*
- name: Remove linux wheel
run: rm dist/*-linux_x86_64.whl
- name: Publish wheel
run: |
/opt/python/${{ matrix.python-version }}/bin/twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}