version auto upgrade

This commit is contained in:
h z
2024-06-23 02:04:14 +08:00
parent 18c38fd9b7
commit de42878ef6
2 changed files with 17 additions and 1 deletions

16
version_upgrade.py Normal file
View File

@@ -0,0 +1,16 @@
import requests
import re
r = requests.get('http://127.0.0.1:3000/api/packages/hzhang/nuget/query')
res = r.text
d = eval(res)
version = ""
for x in d['data']:
if x['id'] == 'Skeleton':
version = x['version']
w = version.split('.')
w[-1] = str(int(w[-1]) + 1)
version = '.'.join(w)
w = open("Skeleton.csproj", "r").read()
h = re.sub(r'<Version>.*</Version>',r'<Version>'+version+'</Version>',w)
with open("Skeleton.csproj", "w") as f:
f.write(h)