Skip to content

Commit

Permalink
Fix generate_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jul 1, 2024
1 parent 2a7ca29 commit 570fd3e
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/scripts/generate_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,38 @@

sys.path.insert(0, os.getcwd())

import ioplace_parser # noqa: E402

print("Getting tags…")

latest_tag = None
latest_tag_commit = None
tags = [pair[1] for pair in gh.ioplace_parser.tags]

tag_exists = ioplace_parser.__version__ in tags

def __get_version():
import re

rx = re.compile(r"version\s*=\s*\"([^\"]+)\"")
__oldir__ = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
pyproject_path = os.path.join(__oldir__, "pyproject.toml")
try:
match = rx.search(open(pyproject_path, encoding="utf8").read())
assert match is not None, "FATAL: version not found in pyproject.toml"
return match[1]
except FileNotFoundError:
print("Warning: Failed to find OpenLane version.", file=sys.stderr)
return "UNKNOWN"


version = __get_version()

tag_exists = version in tags

if tag_exists:
print("Tag already exists. Leaving NEW_TAG unaltered.")
else:
new_tag = ioplace_parser.__version__
new_tag = version

print("Found new tag %s." % new_tag)
gh.export_env("NEW_TAG", new_tag)

0 comments on commit 570fd3e

Please sign in to comment.