docs: def main(
      set_to=None,
      set_patch_count=None,
      release=None,
      bump=None,
      lock=None,
      file_triggers=None,
      config_path=None,
      **extra_updates
  ):
      """Main workflow.
  
      Load config from cli and file
      Detect "bump triggers" - things that cause a version increment
      Find the current version
      Create a new version
      Write out new version and any other requested variables
  
      :param set_to: explicitly set semver to this version string
      :param set_patch_count: sets the patch number to the commit count
      :param release: marks with a production flag
                  just sets a single flag as per config
      :param bump: string indicating major/minor/patch
                  more significant bumps will zero the less significant ones
      :param lock: locks the version string for the next call to autoversion
                  lock only removed if a version bump would have occurred
      :param file_triggers: whether to enable bumping based on file triggers
                  bumping occurs once if any file(s) exist that match the config
      :param config_path: path to config file
      :param extra_updates:
      :return:
      """
      updates = {}
  
      if config_path:
          get_or_create_config(config_path, config)
  
      for k, v in config.regexers.items():
          config.regexers[k] = re.compile(v)
  
      # a forward-mapping of the configured aliases
      # giving <our config param> : <the configured value>
      # if a value occurs multiple times, we take the last set value
      for k, v in config.key_aliases.items():
          config._forward_aliases[v] = k
  
      all_data = read_targets(config.targets)
      current_semver = semver.get_current_semver(all_data)
  
      triggers = get_all_triggers(bump, file_triggers)
      updates.update(get_lock_behaviour(triggers, all_data, lock))
      updates.update(get_dvcs_info())
  
      if set_to:
          _LOG.debug("setting version directly: %s", set_to)
          new_semver = auto_version.definitions.SemVer(*set_to.split("."))
          if not lock:
              warnings.warn(
                  "After setting version manually, does it need locking for a CI flow?",
                  UserWarning,
              )
      elif set_patch_count:
          _LOG.debug(
              "auto-incrementing version, using commit count for patch: %s",
              updates[Constants.COMMIT_COUNT_FIELD],
          )
          new_semver = semver.make_new_semver(
              current_semver, triggers, patch=updates[Constants.COMMIT_COUNT_FIELD]
          )
      else:
          _LOG.debug("auto-incrementing version")
          new_semver = semver.make_new_semver(current_semver, triggers)
  
      updates.update(
          get_final_version_string(
              release_mode=release,
              semver=new_semver,
              commit_count=updates.get(Constants.COMMIT_COUNT_FIELD, 0),
          )
      )
  
      for part in semver.SemVerSigFig:
          updates[part] = getattr(new_semver, part)
  
      # only rewrite a field that the user has specified in the configuration
      native_updates = {
          native: updates[key]
          for native, key in config.key_aliases.items()
          if key in updates
      }
  
      # finally, add in commandline overrides
      native_updates.update(extra_updates)
  
      write_targets(config.targets, **native_updates)
  
      return current_semver, new_semver, native_updates