# This workflow uploads a Python Package to PyPI using Poetry when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. name: Pypi on: release: types: [published] permissions: contents: read jobs: deploy: name: Publish python package runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Extract Python Version from pyproject.toml id: python-version run: | version=$(grep 'python =' pyproject.toml | awk -F'"' '{print $2}' | tr -d '^~<=>') echo "python-version=$version" >> $GITHUB_ENV - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.python-version }} - name: Install Poetry run: | python -m pip install --upgrade pip python -m pip install "poetry>=2.0.0,<3.0.0" - name: Install dependencies run: | poetry install --no-root - name: Build the package run: | poetry build # Step 6: Publish to PyPI - name: Publish to PyPI run: | poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}