only get version, safer upgrade

This commit is contained in:
BennyThink 2022-01-03 14:30:17 +08:00
parent 79496fcd8a
commit b5aeee2c6e
No known key found for this signature in database
GPG Key ID: 6CD0DBDA5235D481
3 changed files with 5 additions and 6 deletions

View File

@ -18,6 +18,7 @@ jobs:
username: root username: root
key: ${{ secrets.SSH_KEY }} key: ${{ secrets.SSH_KEY }}
script: | script: |
docker save bennythink/ytdlbot > ~/ytdlbot-old.tar
cd /home/ytdlbot cd /home/ytdlbot
make bot make bot
make upgrade-all-worker make upgrade-all-worker

View File

@ -98,7 +98,6 @@ def current_time():
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
def get_revision_tag(): def get_revision():
revision = subprocess.check_output("git -C ../ rev-parse --short HEAD".split()).decode("u8").replace("\n", "") revision = subprocess.check_output("git -C ../ rev-parse --short HEAD".split()).decode("u8").replace("\n", "")
tag = subprocess.check_output("git -C ../ describe --tags".split()).decode("u8").replace("\n", "") return revision
return revision, tag

View File

@ -27,7 +27,7 @@ from db import MySQL, Redis
from downloader import convert_flac from downloader import convert_flac
from limit import verify_payment from limit import verify_payment
from tasks import download_entrance from tasks import download_entrance
from utils import (customize_logger, get_revision_tag, get_user_settings, from utils import (customize_logger, get_revision, get_user_settings,
set_user_settings) set_user_settings)
customize_logger(["pyrogram.client", "pyrogram.session.session", "pyrogram.connection.connection"]) customize_logger(["pyrogram.client", "pyrogram.session.session", "pyrogram.connection.connection"])
@ -220,7 +220,6 @@ def audio_callback(client: "Client", callback_query: types.CallbackQuery):
if __name__ == '__main__': if __name__ == '__main__':
MySQL() MySQL()
revision_tag = get_revision_tag()
scheduler = BackgroundScheduler() scheduler = BackgroundScheduler()
scheduler.add_job(Redis().reset_today, 'cron', hour=0, minute=0) scheduler.add_job(Redis().reset_today, 'cron', hour=0, minute=0)
scheduler.start() scheduler.start()
@ -231,7 +230,7 @@ if __name__ == '__main__':
By @BennyThink, VIP mode: {ENABLE_VIP}, Distribution: {ENABLE_CELERY} By @BennyThink, VIP mode: {ENABLE_VIP}, Distribution: {ENABLE_CELERY}
Version: {revision_tag[0]}@{revision_tag[1]} Version: {get_revision()}
""" """
print(banner) print(banner)
app.run() app.run()