Skip to content

Commit

Permalink
fix(vcs): allow cli to be run from subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
vicrep authored and relekang committed May 15, 2019
1 parent 76123f4 commit fb7bb14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion semantic_release/vcs_helpers.py
@@ -1,6 +1,8 @@
"""VCS Helpers
"""
import os
import re
from pathlib import PurePath
from typing import Optional, Tuple

import ndebug
Expand Down Expand Up @@ -112,7 +114,12 @@ def commit_new_version(version: str):
check_repo()
commit_message = config.get('semantic_release', 'commit_message')
message = '{0}\n\n{1}'.format(version, commit_message)
repo.git.add(config.get('semantic_release', 'version_variable').split(':')[0])

version_file = config.get('semantic_release', 'version_variable').split(':')[0]
# get actual path to filename, to allow running cmd from subdir of git root
version_filepath = PurePath(os.getcwd(), version_file).relative_to(repo.working_dir)

repo.git.add(str(version_filepath))
return repo.git.commit(m=message, author="semantic-release <semantic-release>")


Expand Down

0 comments on commit fb7bb14

Please sign in to comment.