-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update version number in manifest.yml (#755)
* Add automation to update version number in manifest.yml * Make updater file executable
- Loading branch information
1 parent
b1a8511
commit cd87a39
Showing
2 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import argparse | ||
|
||
THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) | ||
MANIFEST_FILE = os.path.join(THIS_FILE_PATH, '..', '..', 'manifest.yml') | ||
|
||
def update_manifest_file(new_version_number): | ||
updated_lines = [] | ||
with open(MANIFEST_FILE, 'r') as f: | ||
for line in f: | ||
line = line.strip() | ||
if line.startswith('version'): | ||
updated_lines.append(f'version: "v{new_version_number}"\n') | ||
else: | ||
updated_lines.append(f'{line}\n') | ||
|
||
with open(MANIFEST_FILE, 'w') as f: | ||
f.writelines(updated_lines) | ||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-v', '--version', required=True, help='New version number.') | ||
args = parser.parse_args() | ||
return args | ||
|
||
def main(): | ||
args = parse_args() | ||
update_manifest_file(args.version) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters