From a6782080c47db0a97ca1694c9666f2ec91cafee6 Mon Sep 17 00:00:00 2001 From: Buys de Barbanson Date: Mon, 14 Oct 2024 15:06:23 +0200 Subject: [PATCH] Update pythonpublish.yml --- .github/workflows/pythonpublish.yml | 45 +++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index b0b4e983..ba8a8bb4 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -1,26 +1,47 @@ -name: Upload Python Package +name: Publish Python Package on: release: types: [created] +permissions: + contents: read + jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install '.[test]' + - name: Run tests + run: | + pytest deploy: runs-on: ubuntu-latest + needs: [test] + environment: release + permissions: + id-token: write steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.12" - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + pip install setuptools wheel build + - name: Build run: | - python setup.py sdist bdist_wheel - twine upload dist/* + python -m build + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1