6 Commits
3 changed files with 46 additions and 16 deletions
+23
View File
@@ -0,0 +1,23 @@
name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- run: git log $(git describe --tags --abbrev=0 HEAD~1)..HEAD --oneline > changelog.txt
- uses: softprops/action-gh-release@v2
with:
make_latest: true
body_path: changelog.txt
files: astrolobot.py
+22 -15
View File
@@ -10,24 +10,27 @@ import json,sys,webbrowser,importlib,tomllib
def update():
print('checking for updates...')
with open(script_path()+'astrolobot.py','r') as file:
current_script=file.read()
urlretrieve(
'https://github.com/sugoidogo/astrolobot/releases/latest/download/astrolobot.py',
script_path()+'astrolobot.py'
)
with open(script_path()+'astrolobot.py','r') as file:
updated_script=file.read()
if current_script==updated_script:
print('up to date')
else:
print('update downloaded, restart script to apply')
try:
with open(script_path()+'astrolobot.py','r') as file:
current_script=file.read()
urlretrieve(
'https://gitea.sugoidogo.com/SugoiDogo/astrolobot/releases/download/latest/astrolobot.py',
script_path()+'astrolobot.py'
)
with open(script_path()+'astrolobot.py','r') as file:
updated_script=file.read()
if current_script==updated_script:
print('up to date')
else:
print('update downloaded, restart script to apply')
except:
print('update check failed, ignoring')
def dependency_setup():
if not path.exists(script_path()+'pip'):
print('installing dependencies')
from pip._internal.cli.main import main as pip
pip(['install','-qq','pyswisseph','twitch.py','--target',script_path()+'pip'])
pip(['install','-qq','-r',script_path()+'/requirements.txt','--target',script_path()+'pip'])
sys.path.append(script_path()+'pip')
@@ -394,7 +397,11 @@ def login(*args):
global device_code
if device_code==None:
print('astrolobot is still starting, please wait',sys.stderr)
webbrowser.open('https://www.twitch.tv/activate?public=true&device-code='+device_code)
else:
login_url='https://www.twitch.tv/activate?public=true&device-code='+device_code
print("if your browser doesn't automatically open, go to the following url:")
print(login_url)
webbrowser.open(login_url)
def save_tokens(access_token,refresh_token):
with open(script_path()+'tokens.json','w') as file:
@@ -463,7 +470,7 @@ def main():
async def on_code(code: str):
global device_code, obs_settings
device_code=code
if obs_settings == None:
if len(tokens)==0:
login()
@client.event
+1 -1
View File
@@ -1,2 +1,2 @@
pyswisseph
twitch.py
twitch.py == 3.*