Publish to PyPI #12
This file contains 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: | |
workflow_dispatch: # Enable manual runs | |
jobs: | |
# Run tests before publishing | |
call_tests: | |
uses: ./.github/workflows/tests.yml | |
publish_to_pypi: | |
runs-on: ubuntu-latest | |
needs: call_tests | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install Poetry | |
run: | | |
pip install poetry | |
- name: Install Dependencies | |
run: | | |
poetry install | |
# - name: Update Version | |
# run: | | |
# poetry version patch # Use 'minor' or 'major' for minor or major version bumps | |
# - name: Build Package | |
# run: | | |
# poetry build | |
# Automatically create a new tag for the release | |
# - name: Create Tag | |
# run: | | |
# VERSION=$(poetry version -s) # Get version from pyproject.toml | |
# git config user.name "github-actions" | |
# git config user.email "[email protected]" | |
# git tag v$VERSION | |
# git push origin v$VERSION | |
# - name: Upload Release Asset | |
# uses: softprops/action-gh-release@v2 # Uploads the wheel files to the GitHub release | |
# with: | |
# files: dist/*.whl | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Publish Package | |
run: | | |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} # Make sure you've set `secrets.PYPI_API_TOKEN` | |
poetry publish --build |