From d11d1f3bd02001fc9898229de0eb43535b4f759c Mon Sep 17 00:00:00 2001 From: Sabrina Demagny Date: Mon, 21 Oct 2024 23:35:49 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(script)=20improve=20and=20fix=20re?= =?UTF-8?q?lease=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use regex to replace version and add missing frontend update version. --- CHANGELOG.md | 5 +++++ scripts/release.py | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 073d25992..b2066230e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to ## [Unreleased] +### Fixed + +- 🐛(script) improve and fix release script + + ## [1.3.1] - 2024-10-18 ## [1.3.0] - 2024-10-18 diff --git a/scripts/release.py b/scripts/release.py index be87fde72..b59681ffb 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -1,5 +1,6 @@ import datetime import os +import re import sys from utils import run_command @@ -17,9 +18,7 @@ def update_files(version): lines = file.readlines() for index, line in enumerate(lines): if line.startswith("version = "): - last_version = line.split("=")[-1] - new_line = line.replace(last_version, f' "{version}"\n') - lines[index] = new_line + lines[index] = re.sub(r'\"(.*?)\"', f'"{version}"', line) with open(path, 'w+') as file: file.writelines(lines) @@ -30,8 +29,8 @@ def update_files(version): with open(path, 'r') as file: lines = file.readlines() for index, line in enumerate(lines): - if line.startswith(" tag: "): - lines[index] = f' tag: "v{version}"\n' + if "tag:" in line: + lines[index] = re.sub(r'\"(.*?)\"', f'"v{version}"', line) with open(path, 'w+') as file: file.writelines(lines) @@ -47,8 +46,8 @@ def update_files(version): with open(path, 'r') as file: lines = file.readlines() for index, line in enumerate(lines): - if line.startswith(' "version": '): - lines[index] = f' "version": "{version}",\n' + if "version" in line: + lines[index] = re.sub(r'"version": \"(.*?)\"', f'"version": "{version}"', line) with open(path, 'w+') as file: file.writelines(lines) return