Skip to content

Merge pull request #11 from CerebusOSS/hitl_testing_dev #33

Merge pull request #11 from CerebusOSS/hitl_testing_dev

Merge pull request #11 from CerebusOSS/hitl_testing_dev #33

name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
workflow_dispatch: {}
push:
branches:
- main
pull_request:
branches:
- main
types:
- closed
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
- name: Test with pytest
run: |
pytest
- name: Install pypa/build
run: >-
pip install build --user
- name: Build a source tarball and a binary wheel
run: >-
python3 -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1