]>
Commit | Line | Data |
---|---|---|
f940c317 | 1 | from __future__ import unicode_literals |
915f2a92 | 2 | from datetime import datetime |
915f2a92 U |
3 | |
4 | exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec')) | |
5 | ||
6 | _LATEST_VERSION = locals()['__version__'] | |
7 | ||
5b328c97 | 8 | _OLD_VERSION = _LATEST_VERSION.replace('-', '.').split(".", 4) |
915f2a92 | 9 | |
5b328c97 | 10 | old_ver = '.'.join(_OLD_VERSION[:3]) |
11 | old_rev = _OLD_VERSION[3] if len(_OLD_VERSION) > 3 else '' | |
915f2a92 | 12 | |
5b328c97 | 13 | ver = datetime.now().strftime("%Y.%m.%d") |
14 | rev = str(int(old_rev or 0) + 1) if old_ver == ver else '' | |
915f2a92 | 15 | |
5b328c97 | 16 | version = '.'.join((ver, rev)) if rev else ver |
915f2a92 | 17 | |
afe4cdcf | 18 | print('::set-output name=ytdlc_version::' + version) |
915f2a92 U |
19 | |
20 | file_version_py = open('youtube_dlc/version.py', 'rt') | |
21 | data = file_version_py.read() | |
5b328c97 | 22 | data = data.replace(_LATEST_VERSION, version) |
915f2a92 | 23 | file_version_py.close() |
5b328c97 | 24 | |
915f2a92 U |
25 | file_version_py = open('youtube_dlc/version.py', 'wt') |
26 | file_version_py.write(data) | |
27 | file_version_py.close() |