Publish to PyPI #14
This file contains hidden or 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: Publish to PyPI | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: # Allows you to run this manually for testing | |
| jobs: | |
| test: | |
| name: Run Automated Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| pip install "numpy<2" pytest matplotlib pandas scipy | |
| pip install -e . | |
| - name: Run Pytest | |
| run: pytest tests | |
| build-n-publish: | |
| name: Build and publish to PyPI | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/XdetectionCore | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| - name: Install build tool | |
| run: pip install build | |
| - name: Build binary | |
| run: | | |
| rm -rf dist/ # Force delete any existing dist folder | |
| python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |