diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f98f652..ff7d5fe 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,29 +1,34 @@ -name: Publish Python distribution to TestPyPI +name: Publish Python distribution to PyPI -on: push +on: + push: + tags: + - 'v*' jobs: - - publish-to-testpypi: - name: Publish Python distribution to TestPyPI - needs: - - build + build-and-publish: runs-on: ubuntu-latest - environment: - name: testpypi - url: https://test.pypi.org/p/ + steps: + - name: Check out the code + uses: actions/checkout@v3 - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing + - name: Set up Python environment + uses: actions/setup-python@v4 + with: + python-version: 3.9 - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - 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/ + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel twine + + - name: Build the package + run: | + python setup.py sdist bdist_wheel + + - name: Publish to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* \ No newline at end of file