]> jfr.im git - yt-dlp.git/blame - scripts/update-version-workflow.py
Changed revision number to use '.' instead of '-'
[yt-dlp.git] / scripts / update-version-workflow.py
CommitLineData
f940c317 1from __future__ import unicode_literals
915f2a92 2from datetime import datetime
915f2a92
U
3
4exec(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 10old_ver = '.'.join(_OLD_VERSION[:3])
11old_rev = _OLD_VERSION[3] if len(_OLD_VERSION) > 3 else ''
915f2a92 12
5b328c97 13ver = datetime.now().strftime("%Y.%m.%d")
14rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
915f2a92 15
5b328c97 16version = '.'.join((ver, rev)) if rev else ver
915f2a92 17
afe4cdcf 18print('::set-output name=ytdlc_version::' + version)
915f2a92
U
19
20file_version_py = open('youtube_dlc/version.py', 'rt')
21data = file_version_py.read()
5b328c97 22data = data.replace(_LATEST_VERSION, version)
915f2a92 23file_version_py.close()
5b328c97 24
915f2a92
U
25file_version_py = open('youtube_dlc/version.py', 'wt')
26file_version_py.write(data)
27file_version_py.close()