mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1011 B
Python
31 lines
1011 B
Python
4 years ago
|
from __future__ import unicode_literals
|
||
4 years ago
|
from datetime import datetime
|
||
4 years ago
|
# import urllib.request
|
||
4 years ago
|
|
||
4 years ago
|
# response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
|
||
|
# _LATEST_VERSION = response.read().decode('utf-8')
|
||
4 years ago
|
|
||
4 years ago
|
exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
|
||
4 years ago
|
_LATEST_VERSION = locals()['__version__']
|
||
|
|
||
4 years ago
|
_OLD_VERSION = _LATEST_VERSION.replace('-', '.').split(".", 4)
|
||
4 years ago
|
|
||
4 years ago
|
old_ver = '.'.join(_OLD_VERSION[:3])
|
||
|
old_rev = _OLD_VERSION[3] if len(_OLD_VERSION) > 3 else ''
|
||
4 years ago
|
|
||
4 years ago
|
ver = datetime.now().strftime("%Y.%m.%d")
|
||
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
||
4 years ago
|
|
||
4 years ago
|
version = '.'.join((ver, rev)) if rev else ver
|
||
4 years ago
|
|
||
4 years ago
|
print('::set-output name=ytdlc_version::' + version)
|
||
4 years ago
|
|
||
|
file_version_py = open('youtube_dlc/version.py', 'rt')
|
||
|
data = file_version_py.read()
|
||
4 years ago
|
data = data.replace(_LATEST_VERSION, version)
|
||
4 years ago
|
file_version_py.close()
|
||
4 years ago
|
|
||
4 years ago
|
file_version_py = open('youtube_dlc/version.py', 'wt')
|
||
|
file_version_py.write(data)
|
||
|
file_version_py.close()
|