]>
jfr.im git - yt-dlp.git/blob - scripts/update-version-workflow.py
1 from __future__
import unicode_literals
2 from datetime
import datetime
3 # import urllib.request
5 # response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
6 # _LATEST_VERSION = response.read().decode('utf-8')
8 exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
10 _LATEST_VERSION
= locals()['__version__']
12 _OLD_VERSION
= _LATEST_VERSION
.rsplit("-", 1)
14 if len(_OLD_VERSION
) > 0:
15 old_ver
= _OLD_VERSION
[0]
18 if len(_OLD_VERSION
) > 1:
19 old_rev
= _OLD_VERSION
[1]
22 # ver = f'{datetime.today():%Y.%m.%d}'
23 ver
= now
.strftime("%Y.%m.%d")
28 rev
= int(old_rev
) + 1
34 version
= _SEPARATOR
.join(filter(None, [ver
, str(rev
)]))
36 print('::set-output name=ytdlc_version::' + version
)
38 file_version_py
= open('youtube_dlc/version.py', 'rt')
39 data
= file_version_py
.read()
40 data
= data
.replace(locals()['__version__'], version
)
41 file_version_py
.close()
42 file_version_py
= open('youtube_dlc/version.py', 'wt')
43 file_version_py
.write(data
)
44 file_version_py
.close()