Skip to content

pypi-publish

pypi-publish #17

Workflow file for this run

# A workflow to publish releases to PyPi and TestPyPi.
name: pypi-publish
on:
release:
types: [published]
workflow_dispatch:
inputs:
upload_to_test_pypi:
description: 'Upload to Test PyPi'
type: boolean
default: false
upload_to_pypi:
description: 'Upload to PyPi'
type: boolean
default: false
permissions: read-all
jobs:
pypi-publish:
name: Upload to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dm-meltingpot
permissions:
id-token: write
timeout-minutes: 90
steps:
- name: Checkout Melting Pot
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Show python version
run: pip list
- name: Build source distribution
run: python setup.py sdist
- name: Install from source distribution
run: |
python -m venv venv
source venv/bin/activate
pip install dist/dm-meltingpot-*.tar.gz
pip install pytest-xdist
pytest -n auto --pyargs meltingpot
- name: Publish to TestPyPI
if: github.event_name == 'release' || inputs.upload_to_test_pypi
uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
- name: Publish to PyPI
if: github.event_name == 'release' || inputs.upload_to_pypi
uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06
with:
verbose: true