name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI on: push jobs: build: name: Build distribution 📦 runs-on: ubuntu-latest defaults: run: working-directory: ./Server steps: - uses: actions/checkout@v6 - name: Install uv uses: astral-sh/setup-uv@v7 with: version: "latest" enable-cache: true cache-dependency-glob: "Server/uv.lock" - name: Build a binary wheel and a source tarball run: uv build - name: Store the distribution packages uses: actions/upload-artifact@v6 with: name: python-package-distributions path: Server/dist/ publish-to-pypi: name: >- Publish Python 🐍 distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes needs: - build runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/mcpforunityserver permissions: id-token: write steps: - name: Download all the dists uses: actions/download-artifact@v7 with: name: python-package-distributions path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 publish-to-testpypi: name: Publish Python 🐍 distribution 📦 to TestPyPI needs: - build runs-on: ubuntu-latest environment: name: testpypi url: https://test.pypi.org/p/mcpforunityserver permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - name: Download all the dists uses: actions/download-artifact@v7 with: name: python-package-distributions path: dist/ - name: Publish distribution 📦 to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/