Skip to content

Commit

Permalink
🐛(script) improve and fix release script
Browse files Browse the repository at this point in the history
Use regex to replace version and add missing
frontend update version.
  • Loading branch information
sdemagny committed Oct 21, 2024
1 parent 6a22169 commit d11d1f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions scripts/release.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import os
import re
import sys

from utils import run_command
Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit d11d1f3

Please sign in to comment.