🐛(script) improve and fix release script
Use regex to replace version and add missing frontend update version.
This commit is contained in:
@@ -8,6 +8,11 @@ and this project adheres to
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 🐛(script) improve and fix release script
|
||||||
|
|
||||||
|
|
||||||
## [1.3.1] - 2024-10-18
|
## [1.3.1] - 2024-10-18
|
||||||
|
|
||||||
## [1.3.0] - 2024-10-18
|
## [1.3.0] - 2024-10-18
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from utils import run_command
|
from utils import run_command
|
||||||
@@ -17,9 +18,7 @@ def update_files(version):
|
|||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
for index, line in enumerate(lines):
|
for index, line in enumerate(lines):
|
||||||
if line.startswith("version = "):
|
if line.startswith("version = "):
|
||||||
last_version = line.split("=")[-1]
|
lines[index] = re.sub(r'\"(.*?)\"', f'"{version}"', line)
|
||||||
new_line = line.replace(last_version, f' "{version}"\n')
|
|
||||||
lines[index] = new_line
|
|
||||||
with open(path, 'w+') as file:
|
with open(path, 'w+') as file:
|
||||||
file.writelines(lines)
|
file.writelines(lines)
|
||||||
|
|
||||||
@@ -30,8 +29,8 @@ def update_files(version):
|
|||||||
with open(path, 'r') as file:
|
with open(path, 'r') as file:
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
for index, line in enumerate(lines):
|
for index, line in enumerate(lines):
|
||||||
if line.startswith(" tag: "):
|
if "tag:" in line:
|
||||||
lines[index] = f' tag: "v{version}"\n'
|
lines[index] = re.sub(r'\"(.*?)\"', f'"v{version}"', line)
|
||||||
with open(path, 'w+') as file:
|
with open(path, 'w+') as file:
|
||||||
file.writelines(lines)
|
file.writelines(lines)
|
||||||
|
|
||||||
@@ -47,8 +46,8 @@ def update_files(version):
|
|||||||
with open(path, 'r') as file:
|
with open(path, 'r') as file:
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
for index, line in enumerate(lines):
|
for index, line in enumerate(lines):
|
||||||
if line.startswith(' "version": '):
|
if "version" in line:
|
||||||
lines[index] = f' "version": "{version}",\n'
|
lines[index] = re.sub(r'"version": \"(.*?)\"', f'"version": "{version}"', line)
|
||||||
with open(path, 'w+') as file:
|
with open(path, 'w+') as file:
|
||||||
file.writelines(lines)
|
file.writelines(lines)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user