Skip to content

Commit

Permalink
Merge pull request #2538 from wazuh/bug/update-version-file
Browse files Browse the repository at this point in the history
Update version file and add function to bump_version script
  • Loading branch information
vikman90 authored Oct 19, 2023
2 parents b3b849c + 0738dde commit 8cb9141
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ All notable changes to this project will be documented in this file.
## [4.5.4]

- https://github.com/wazuh/wazuh-packages/releases/tag/v4.5.4

## [4.5.3]

- https://github.com/wazuh/wazuh-packages/releases/tag/v4.5.3

## [4.5.2]

- https://github.com/wazuh/wazuh-packages/releases/tag/v4.5.2
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.5.3
4.5.4
16 changes: 15 additions & 1 deletion bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
test_files=glob.glob('**/test-*.sh', recursive=True)
install_variables_files=glob.glob('**/installVariables.sh', recursive=True)
changelog_md_files=glob.glob('**/CHANGELOG.md', recursive=True)
VERSION_files=glob.glob('**/VERSION', recursive=True)

## Bump version in .spec files
SPEC_FORMAT_STRING="%a %b %d %Y"
Expand Down Expand Up @@ -180,9 +181,22 @@
REGEX=(r'All notable changes to this project '
r'will be documented in this file.')
changelog_string=(f"## [{version}]\n\n- https://github.com/wazuh/"
f"wazuh-packages/releases/tag/v{version}")
f"wazuh-packages/releases/tag/v{version}\n")
filedata=re.sub(REGEX, REGEX + '\n' + changelog_string,
filedata)

with open(changelog_md_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in VERSION files

for VERSION_file in VERSION_files:
with open(VERSION_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + VERSION_file)
filedata=file.read()
# Replace version and revision
REGEX=r'(\d+\.\d+\.\d+)'
filedata=re.sub(REGEX, f'{version}', filedata)

with open(VERSION_file, 'w', encoding="utf-8") as file:
file.write(filedata)

0 comments on commit 8cb9141

Please sign in to comment.