Skip to content

Commit

Permalink
remove rich tracebacks, add auto-release
Browse files Browse the repository at this point in the history
  • Loading branch information
lzgirlcat committed Oct 4, 2024
1 parent b07417b commit 4d7bab5
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/auto-release.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions koleo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
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
from .types import ExtendedBaseStationInfo, TrainDetailResponse, TrainOnStationInfo
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,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4d7bab5

Please sign in to comment.