MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / tag

Function tag

lib/devtools/src/crewai_devtools/cli.py:2223–2324  ·  view source on GitHub ↗

Create and push a version tag on main branch. Run this after the version bump PR has been merged. Automatically detects version from __version__ in packages. Args: dry_run: Show what would be done without making changes. no_edit: Skip editing release notes.

(dry_run: bool, no_edit: bool)

Source from the content-addressed store, hash-verified

2221)
2222@click.option("--no-edit", is_flag=True, help="Skip editing release notes")
2223def tag(dry_run: bool, no_edit: bool) -> None:
2224 """Create and push a version tag on main branch.
2225
2226 Run this after the version bump PR has been merged.
2227 Automatically detects version from __version__ in packages.
2228
2229 Args:
2230 dry_run: Show what would be done without making changes.
2231 no_edit: Skip editing release notes.
2232 """
2233 console.print(
2234 "\n[yellow]Note:[/yellow] [bold]devtools tag[/bold] only tags and creates "
2235 "a GitHub release for this repo. It will not bump versions, publish to "
2236 "PyPI, or release enterprise.\n"
2237 "If you want a full end-to-end release, run "
2238 "[bold]devtools release <version>[/bold] instead."
2239 )
2240 if not Confirm.ask("Continue with tag only?", default=True):
2241 sys.exit(0)
2242
2243 try:
2244 cwd = Path.cwd()
2245 lib_dir = cwd / "lib"
2246
2247 packages = get_packages(lib_dir)
2248
2249 with console.status("[cyan]Validating package versions..."):
2250 versions = {}
2251 for pkg in packages:
2252 version_files = find_version_files(pkg)
2253 for vfile in version_files:
2254 content = vfile.read_text()
2255 for line in content.splitlines():
2256 if line.strip().startswith("__version__"):
2257 ver = line.split("=")[1].strip().strip('"').strip("'")
2258 versions[vfile.relative_to(cwd)] = ver
2259 break
2260
2261 if not versions:
2262 console.print(
2263 "[red]✗[/red] Validated package versions: Could not find __version__ in any package"
2264 )
2265 sys.exit(1)
2266
2267 unique_versions = set(versions.values())
2268 if len(unique_versions) > 1:
2269 console.print(
2270 "[red]✗[/red] Validated package versions: Version mismatch detected"
2271 )
2272 for file, ver in versions.items():
2273 console.print(f" {file}: {ver}")
2274 sys.exit(1)
2275
2276 version = unique_versions.pop()
2277 console.print(f"[green]✓[/green] Validated packages @ [bold]{version}[/bold]")
2278 tag_name = version
2279
2280 if not dry_run:

Callers

nothing calls this directly

Calls 12

get_packagesFunction · 0.85
find_version_filesFunction · 0.85
_generate_release_notesFunction · 0.85
_poll_pr_until_mergedFunction · 0.85
_create_tag_and_releaseFunction · 0.85
askMethod · 0.80
statusMethod · 0.80
read_textMethod · 0.80
popMethod · 0.80
run_commandFunction · 0.70
printMethod · 0.45

Tested by

no test coverage detected