Skip to content

Publish to PyPi

Publish to PyPi #62

# This workflow publishes the package to pypi.
# For more details:
# https://docs.github.com/en/actions/guides/building-and-testing-python#publishing-to-package-registries
name: Publish to PyPi
on:
release:
types: [created]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# fetch all tags so `versioneer` can properly determine current version
with:
fetch-depth: 0
- name: Check if current commit is tagged
# fails and cancels release if the current commit is not tagged
run: |
git describe --exact-match --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Test build
# fails and cancels release if the built package fails to import
run: |
pip install dist/*.whl
python -c 'import rubicon_ml; print(rubicon_ml.__version__)'
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_REPOSITORY: pypi
run: |
twine upload dist/*