| 1 | name: build and publish |
| 2 | |
| 3 | on: workflow_call |
| 4 | |
| 5 | jobs: |
| 6 | release: |
| 7 | runs-on: ubuntu-22.04 |
| 8 | continue-on-error: false |
| 9 | steps: |
| 10 | - uses: actions/checkout@v4 |
| 11 | with: |
| 12 | fetch-depth: 0 |
| 13 | - name: Set up Python |
| 14 | uses: actions/setup-python@v5 |
| 15 | with: |
| 16 | python-version: "3.11" |
| 17 | - name: Install python dependencies |
| 18 | run: | |
| 19 | python -m pip install --upgrade pip build |
| 20 | - name: Build sdist |
| 21 | run: | |
| 22 | python -m build |
| 23 | - name: Publish distribution 📦 to Test PyPI |
| 24 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 25 | if: startsWith(github.ref, 'refs/tags') != true |
| 26 | with: |
| 27 | password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 28 | repository-url: https://test.pypi.org/legacy/ |
| 29 | - name: Publish distribution 📦 to PyPI |
| 30 | if: startsWith(github.ref, 'refs/tags') |
| 31 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 32 | with: |
| 33 | password: ${{ secrets.PYPI_API_TOKEN }} |