From 0d0c7842c5e67439676c103d2a0eda3833669475 Mon Sep 17 00:00:00 2001 From: Delgan Date: Tue, 3 Dec 2024 16:45:26 +0100 Subject: [PATCH] Use tox to define the "release" command --- .github/workflows/release.yaml | 26 -------------------------- .github/workflows/release.yml | 27 +++++++++++++++++++++++++++ tox.ini | 9 +++++++++ 3 files changed, 36 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 9c4babf8e..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: release - -on: - push: - tags: - - '*' - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - - run: pipx run build - - - run: twine check --strict dist/* - - - run: pipx run twine upload dist/* --disable-progress-bar - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b4ff6d8cd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox + - name: Publish release + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + tox -e release diff --git a/tox.ini b/tox.ini index ced401f8a..bc3ad216f 100644 --- a/tox.ini +++ b/tox.ini @@ -29,3 +29,12 @@ description = Build the Python package. commands = pyproject-build . twine check --strict dist/* + +[testenv:release] +description = Publish a new release on PyPI. +passenv = + TWINE_USERNAME + TWINE_PASSWORD +commands = + {[testenv:packaging]commands} + twine upload dist/* --disable-progress-bar --verbose