Skip to content

Commit

Permalink
feat: intoduce TAG_PREFIX instead of RELEASE_TAG_PREFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
kvendingoldo committed May 27, 2024
1 parent ef0bf7d commit d6ca76b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ inputs:
description: 'GitHub token that requires for operate under GitHub. You can use secrets GITHUB_TOKEN, check example'
required: false
default: ''
release_tag_prefix:
description: 'Prefix for Git release tags'
tag_prefix:
description: 'Prefix for Git tags'
required: false
default: ''
log_level:
Expand Down
9 changes: 4 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

INIT_VERSION = os.getenv("INPUT_INIT_VERSION")
PRIMARY_BRANCH = os.getenv("INPUT_PRIMARY_BRANCH")
RELEASE_TAG_PREFIX = os.getenv("INPUT_RELEASE_TAG_PREFIX", "")
TAG_PREFIX = os.getenv("INPUT_TAG_PREFIX", "")
GITHUB_TOKEN = os.environ.get("INPUT_GITHUB_TOKEN")
GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY")
GITHUB_RELEASES_URL = "https://api.github.com/repos/{repo}/releases"
Expand Down Expand Up @@ -53,7 +53,7 @@ def get_base_version(ref='HEAD'):
logging.debug("Read latest upstream tag: %s", latest_tag)

if latest_tag:
latest_base_version = semver.VersionInfo.parse(latest_tag.replace(RELEASE_TAG_PREFIX, "").split('/')[-1])
latest_base_version = semver.VersionInfo.parse(latest_tag.replace(TAG_PREFIX, "").split('/')[-1])
else:
logging.warning("Unable to get base version. Returning %s", INIT_VERSION)
latest_base_version = semver.VersionInfo.parse(INIT_VERSION)
Expand Down Expand Up @@ -321,6 +321,8 @@ def main():
if current_branch == PRIMARY_BRANCH or current_branch.startswith("release/"):
new_version = get_bumped_version(last_tag, base_version, current_branch, commit_message, tag_for_head)
tag = get_versioned_tag_value(new_version, current_branch, commit_message)
if TAG_PREFIX != "":
tag = TAG_PREFIX + tag

logging.info("Latest upstream BASE version is: %s", base_version)
logging.info("Latest tag value is: %s", last_tag)
Expand All @@ -334,9 +336,6 @@ def main():
logging.info("New tag value is: %s", tag)

if '[RELEASE]' in commit_message and current_branch == PRIMARY_BRANCH:
if RELEASE_TAG_PREFIX != "":
tag = RELEASE_TAG_PREFIX + tag

logging.info("Creating release for last tag: %s", last_tag)

tags = repo.git.tag(sort='-creatordate').split('\n')
Expand Down

0 comments on commit d6ca76b

Please sign in to comment.