-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from RichieHakim/dev
Dev
- Loading branch information
Showing
8 changed files
with
121 additions
and
26 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,43 @@ | ||
import re | ||
import os | ||
|
||
def increment_version(path: str): | ||
""" | ||
Increment the version number in the file at the given path | ||
RH 2024 | ||
Args: | ||
path (str): | ||
Path to the file containing the __version__ variable. | ||
""" | ||
if not os.path.exists(path): | ||
raise FileNotFoundError(f"{path} not found") | ||
|
||
with open(path, 'r') as file: | ||
content = file.readlines() | ||
|
||
for i, line in enumerate(content): | ||
if line.startswith('__version__'): | ||
version_match = re.search(r"'([^']*)'", line) | ||
if version_match: | ||
current_version = version_match.group(1) | ||
version_parts = current_version.split('.') | ||
version_parts[-1] = str(int(version_parts[-1]) + 1) | ||
new_version = '.'.join(version_parts) | ||
content[i] = f"__version__ = '{new_version}'\n" | ||
break | ||
|
||
with open(path, 'w') as file: | ||
file.writelines(content) | ||
|
||
print(f"Version updated to {new_version}") | ||
|
||
import argparse | ||
parser = argparse.ArgumentParser(description='Increment version number in a file') | ||
## Ingest --path argument | ||
parser.add_argument('--path', type=str, help='Path to the version file', required=True) | ||
args = parser.parse_args() | ||
path_version_file = args.path | ||
|
||
if __name__ == "__main__": | ||
increment_version(path_version_file) |
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
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,39 @@ | ||
name: Increment Version | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
description: 'Automated version increment' | ||
required: false | ||
default: '' | ||
|
||
jobs: | ||
increment-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Prepare git branch | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Richard Hakim" | ||
git fetch --all | ||
git checkout dev | ||
git pull | ||
- name: Increment version | ||
run: python .github/scripts/increment_version.py --path face_rhythm/__init__.py | ||
|
||
- name: Commit changes | ||
run: | | ||
git status | ||
git add face_rhythm/__init__.py | ||
git commit -m "Increment version number" | ||
git push |
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
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ dependencies: | |
- python=3.11 | ||
- pip | ||
- pip: | ||
- face-rhythm | ||
- face-rhythm[all] |
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 |
---|---|---|
|
@@ -66,4 +66,4 @@ def prepare_cv2_imshow(): | |
exec('from . import ' + pkg) | ||
|
||
|
||
__version__ = '0.2.2' | ||
__version__ = '0.2.3' |
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
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