Skip to content

Commit

Permalink
Check if new version to commit
Browse files Browse the repository at this point in the history
Instead of catching commit error
  • Loading branch information
Geoffrey JOUNT committed Sep 12, 2023
1 parent 405dd7a commit 79bd61b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def run_command(args):
print(f'--- Running command: {" ".join(args)}')
subprocess.check_call(args)

def check_version_to_commit():
return subprocess.check_output(['git', 'diff', 'roc/version.go']) != b''

def commit_change(version, force):
if not check_version_to_commit():
print('--- Version did not change, nothing to commit')
return
run_command(['git', 'add', 'roc/version.go'])
try:
run_command(['git', 'commit', '-m', f'Release {version}'])
except subprocess.CalledProcessError:
if force:
print('--- Nothing to commit, but --force was used')
else:
raise
run_command(['git', 'commit', '-m', f'Release {version}'])

def create_tag(tag, force):
if force:
Expand Down

0 comments on commit 79bd61b

Please sign in to comment.