A research project focused on developing a lightweight neural voice cloning and speech synthesis system, optimized for deployment on edge devices.
Python
Publish to PyPI from GitHub Actions with trusted publishing
benITo479dc46f232025
diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.ymlnew file mode 100644index 0000000..d2de5c7--- /dev/null+++ b/.github/workflows/publish-pypi.yml@@ -0,0 +1,72 @@+name: Publish to PyPI++on:+ workflow_dispatch:+ inputs:+ dry-run:+ description: Dry run, which builds and tests the package but publishes nothing.+ type: boolean+ default: true+ # Builds and tests the package, without publishing, when a change can affect it+ pull_request:+ paths:+ - reverb_tts/**+ - tests/**+ - pyproject.toml+ - README.md # the PyPI page+ - LICENSE+ - .github/workflows/publish-pypi.yml++jobs:+ build:+ name: Build and test+ runs-on: ubuntu-latest+ steps:+ - name: Check out+ uses: actions/checkout@v4++ - name: Set up Python+ uses: actions/setup-python@v5+ with:+ python-version: "3.12"++ - name: Build the wheel and the sdist+ run: pipx run build++ - name: Check the package metadata+ run: pipx run twine check --strict dist/*++ # Tests the built wheel, not the checkout: pytest without -m doesn't put the repo root on the import path.+ # The tests use a small random model, so they need no weights and no token. CPU torch keeps the install small.+ - name: Test the wheel+ run: |+ python -m venv /tmp/venv+ /tmp/venv/bin/pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu+ /tmp/venv/bin/pip install "$(ls dist/*.whl)[test]"+ /tmp/venv/bin/pytest++ - name: Upload the wheel and the sdist+ uses: actions/upload-artifact@v4+ with:+ name: dist+ path: dist/++ publish:+ name: Publish+ needs: build+ if: github.event_name == 'workflow_dispatch' && !inputs.dry-run+ runs-on: ubuntu-latest+ # The environment that PyPI's trusted publisher names; add required reviewers to it to approve each release+ environment: pypi+ permissions:+ id-token: write # Mints the OIDC token for trusted publishing and attestations+ steps:+ - name: Download the wheel and the sdist+ uses: actions/download-artifact@v4+ with:+ name: dist+ path: dist++ # The version is project.version in pyproject.toml+ - name: Publish+ uses: pypa/gh-action-pypi-publish@release/v1