2020-09-23 03:35:14 +02:00
|
|
|
from __future__ import unicode_literals
|
2020-09-23 03:16:06 +02:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
|
|
|
|
|
|
|
|
_LATEST_VERSION = locals()['__version__']
|
|
|
|
|
2021-01-24 21:47:37 +01:00
|
|
|
_OLD_VERSION = _LATEST_VERSION.replace('-', '.').split(".", 4)
|
2020-09-23 03:16:06 +02:00
|
|
|
|
2021-01-24 21:47:37 +01:00
|
|
|
old_ver = '.'.join(_OLD_VERSION[:3])
|
|
|
|
old_rev = _OLD_VERSION[3] if len(_OLD_VERSION) > 3 else ''
|
2020-09-23 03:16:06 +02:00
|
|
|
|
2021-01-24 21:47:37 +01:00
|
|
|
ver = datetime.now().strftime("%Y.%m.%d")
|
|
|
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
2020-09-23 03:16:06 +02:00
|
|
|
|
2021-01-24 21:47:37 +01:00
|
|
|
version = '.'.join((ver, rev)) if rev else ver
|
2020-09-23 03:16:06 +02:00
|
|
|
|
2020-09-23 03:52:26 +02:00
|
|
|
print('::set-output name=ytdlc_version::' + version)
|
2020-09-23 03:16:06 +02:00
|
|
|
|
|
|
|
file_version_py = open('youtube_dlc/version.py', 'rt')
|
|
|
|
data = file_version_py.read()
|
2021-01-24 21:47:37 +01:00
|
|
|
data = data.replace(_LATEST_VERSION, version)
|
2020-09-23 03:16:06 +02:00
|
|
|
file_version_py.close()
|
2021-01-24 21:47:37 +01:00
|
|
|
|
2020-09-23 03:16:06 +02:00
|
|
|
file_version_py = open('youtube_dlc/version.py', 'wt')
|
|
|
|
file_version_py.write(data)
|
|
|
|
file_version_py.close()
|