From 5bf97ecfd2de2090f80a04d69b9a8a0f064b0af8 Mon Sep 17 00:00:00 2001 From: Mikko Kotila Date: Fri, 29 Mar 2024 14:39:55 +0200 Subject: [PATCH] Update ci-deploy.yml --- .github/workflows/ci-deploy.yml | 46 +++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 21f2f01..c6c249a 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -1,26 +1,46 @@ -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: | + test_script.py 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.x' + 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