def METHOD_NAME(tag):
  # Parse versions from tags
  currentVer = tag.split("/")[1]
  parsedVer = [int(i) for i in currentVer.split(".")]
  # Determine release type
  if parsedVer[2] > 0:
    releaseType = "Patch"
  elif parsedVer[1] > 0:
    releaseType = "Minor"
  else:
    releaseType = "Major"
  print("Generating {0} release notes".format(releaseType.lower()))
  if releaseType == "Patch":
    # Write release to file to preview
    fileName = currentVer + ".md"
    if os.path.exists(fileName):
      os.remove(fileName)
    f = open(fileName, "w")
    f.write("# Release notes\n\n")
    # Determine previous tag and version
    cmd = ['git', 'describe', '--abbrev=0', '--tags', tag + '~1']
    proc = subprocess.Popen(" ".join(cmd), stdin = subprocess.PIPE, stdout = subprocess.PIPE, shell=True)
    previousTag = proc.communicate()[0].decode("utf-8").strip()
    if (len(previousTag) == 0):
      sys.exit("Could not find previous tag for " + tag)
    previousVer = previousTag.split("/")[1]
    # Get SHAs for both tags
    previousSHA = getSHAFromTag(previousTag)
    currentSHA = getSHAFromTag(tag)
    # Get all commit SHAs between tags
    cmd = ['git', 'rev-list', '--ancestry-path', previousSHA + '..' + currentSHA]
    proc = subprocess.Popen(" ".join(cmd), stdin = subprocess.PIPE, stdout = subprocess.PIPE, shell=True)
    # Remove first commit from this list as it will always be a version bump commit
    commits = proc.communicate()[0].decode("utf-8").split()[1:]
    # Write commit messages to release notes
    f.write("## Changes\n\n")
    for commit in commits[::-1]:
      f.write("- {0}\n".format(getCommitMessage(commit)))
    f.write("\n")
    f.write("**Full changelog:** [{0}...{1}](https://github.com/iTwin/itwinjs-core/compare/{2}...{3})\n".format(previousVer, currentVer, previousTag, tag))
    f.close()
  else:
    # If major/minor release, grab corresponding markdown from ./docs/changehistory
    fileName = "docs/changehistory/{0}.md".format(currentVer)
    if not os.path.exists(fileName):
      print("changehistory {0} could not be found.. exiting".format(currentVer))
      return
    replace_image_links(fileName)
    convert_markdown_headings_to_html(fileName)
  # Create GitHub release using the markdown file
  print("Publishing GitHub release...")
  cmd = ['gh', 'release', 'create', tag, '-F', './' + fileName, '-t', '"v{0}"'.format(currentVer)]
  proc = subprocess.Popen(" ".join(cmd), stdin = subprocess.PIPE, stdout = subprocess.PIPE, shell=True)
  proc.wait()