From 4d7bab580b97e90a7272306c61bcd1a1123c9a5e Mon Sep 17 00:00:00 2001 From: lzgirlcat Date: Sat, 5 Oct 2024 00:26:42 +0200 Subject: [PATCH] remove rich tracebacks, add auto-release --- .github/workflows/auto-release.yaml | 61 +++++++++++++++++++++++++++++ koleo/cli.py | 4 -- setup.py | 2 +- 3 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/auto-release.yaml diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 0000000..67cd32d --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,61 @@ +name: Create Release on Version Change + +on: + push: + paths: + - 'setup.py' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel + + - name: Get version from setup.py + id: get_version + run: | + version=$(python setup.py --version) + echo "VERSION=${version}" >> $GITHUB_ENV + + - name: Get latest release + id: get_latest_release + run: | + latest_release=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) + echo "LATEST_RELEASE=${latest_release}" >> $GITHUB_ENV + + - name: Compare versions + id: compare + run: | + if [ "${VERSION}" != "${LATEST_RELEASE}" ]; then + echo "Version has changed" + echo "SHOULD_RELEASE=true" >> $GITHUB_ENV + else + echo "Version has not changed" + echo "SHOULD_RELEASE=false" >> $GITHUB_ENV + + - name: Create release + if: env.SHOULD_RELEASE == 'true' + id: create_release + run: | + new_tag="v${VERSION}" + previous_tag="${LATEST_RELEASE}" + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "'"${new_tag}"'", + "target_commitish": "'"${{ github.sha }}"'", + "name": "'"${{ github.event.head_commit.message }}"'", + "body": "**Full Changelog**: https://github.com/lzgirlcat/koleo-cli/compare/${previous_tag}..${new_tag}", + "draft": false, + "prerelease": false + }' https://api.github.com/repos/${{ github.repository }}/releases diff --git a/koleo/cli.py b/koleo/cli.py index 129ff3f..96e8390 100644 --- a/koleo/cli.py +++ b/koleo/cli.py @@ -3,7 +3,6 @@ from datetime import datetime, timedelta from rich.console import Console -from rich.traceback import install from .api import KoleoAPI from .storage import DEFAULT_CONFIG_PATH, Storage @@ -11,9 +10,6 @@ from .utils import RemainderString, arr_dep_to_dt, convert_platform_number, name_to_slug, parse_datetime -install(show_locals=True, max_frames=2) - - class CLI: def __init__( self, diff --git a/setup.py b/setup.py index b90319f..24ac773 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def parse_requirements_file(path): setuptools.setup( name="koleo-cli", - version="0.2.137.7", + version="0.2.137.8", description="Koleo CLI", long_description=long_description(), long_description_content_type="text/markdown",