]>
jfr.im git - yt-dlp.git/blob - scripts/update-version-workflow.py
1 from datetime
import datetime
2 # import urllib.request
4 # response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
5 # _LATEST_VERSION = response.read().decode('utf-8')
7 exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
9 _LATEST_VERSION
= locals()['__version__']
11 _OLD_VERSION
= _LATEST_VERSION
.rsplit("-", 1)
13 if len(_OLD_VERSION
) > 0:
14 old_ver
= _OLD_VERSION
[0]
17 if len(_OLD_VERSION
) > 1:
18 old_rev
= _OLD_VERSION
[1]
20 ver
= f
'{datetime.today():%Y.%m.%d}'
25 rev
= int(old_rev
) + 1
31 version
= _SEPARATOR
.join(filter(None, [ver
, str(rev
)]))
33 print('::set-output name=ydlc_version::' + version
)
35 file_version_py
= open('youtube_dlc/version.py', 'rt')
36 data
= file_version_py
.read()
37 data
= data
.replace(locals()['__version__'], version
)
38 file_version_py
.close()
39 file_version_py
= open('youtube_dlc/version.py', 'wt')
40 file_version_py
.write(data
)
41 file_version_py
.close()