77 lines
1.8 KiB
YAML
77 lines
1.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.9", "3.10"]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install python build dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip build
|
|
|
|
- name: Build wheels
|
|
run: |
|
|
python -m build --wheel --sdist
|
|
mkdir wheelhouse
|
|
mv dist/* wheelhouse/
|
|
- name: List and check wheels
|
|
run: |
|
|
pip install twine pkginfo>=1.11.0
|
|
${{ matrix.ls || 'ls -lh' }} wheelhouse/
|
|
twine check wheelhouse/*
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-${{ matrix.python-version }}
|
|
path: ./wheelhouse/*
|
|
|
|
upload_to_pypi:
|
|
name: Upload to PyPI
|
|
runs-on: ubuntu-latest
|
|
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch')
|
|
needs: [build]
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/p/fairness-indicators
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- name: Retrieve wheels
|
|
uses: actions/download-artifact@v4.1.8
|
|
with:
|
|
merge-multiple: true
|
|
path: wheels
|
|
|
|
- name: List the build artifacts
|
|
run: |
|
|
ls -lAs wheels/
|
|
|
|
- name: Upload to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1.12
|
|
with:
|
|
packages_dir: wheels/
|
|
repository_url: https://pypi.org/legacy/
|
|
verify_metadata: false
|
|
verbose: true
|