Build and Publish #49
This file contains 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
name: Build and Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'ms_entropy/version.py' | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macos-12] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.17.0 | |
env: | |
CIBW_ARCHS_MACOS: x86_64 arm64 universal2 | |
CIBW_ARCHS_LINUX: x86_64 | |
CIBW_ARCHS_WINDOWS: AMD64 x86 | |
CIBW_SKIP: pp* | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
overwrite: true | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Build | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install setuptools | |
python setup.py sdist | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
overwrite: true | |
upload_pypi: | |
name: Upload to PyPI | |
needs: [build_wheels, build] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |