rlsbl v0.40.1 /rlsbl.commands.release
On this page

Release command that bumps version, validates changelog, runs hooks collecting generated files, tags, pushes, and creates a GitHub Release.

#rlsbl.commands.release

#rlsbl.commands.release

Release command that bumps version, validates changelog, runs hooks (collecting generated files), tags, pushes, and creates a GitHub Release.

#parse_porcelain_paths

python
def parse_porcelain_paths(porcelain_output)

Parse file paths from git status --porcelain output.

Handles the case where run() strips stdout, potentially removing a leading space from the first line. Uses lstrip().split(None, 1) to robustly extract the status code and path regardless.

Returns a set of file paths found in the output.

#resolve_target_paths

python
def resolve_target_paths(version_dir='.')

Build a dict mapping target names to their resolved paths.

Uses detect_targets() which reads .rlsbl/config.json "targets" (supporting both plain strings and dicts with "name"/"path") and falls back to auto-detection.

Returns dict[str, str] mapping target name -> resolved directory path.

#resolve_release_targets

python
def resolve_release_targets(primary, flags, version_dir='.')

Compute the effective set of secondary targets for this release.

Reads the baseline from .rlsbl/config.json "release_targets" list. If absent, falls back to auto-detect (all targets that detect(".")). Entries can be plain strings or dicts with "name" and optional "path".

The primary target is always excluded from the secondary set (it's handled separately by the main release flow).

Returns a dict mapping target name -> resolved directory path.

#_run_builtin_tests

python
def _run_builtin_tests(registry, flags, project_dir=None)

Run built-in tests for the detected project type.

Detects the project type from registry and runs the appropriate test command. When project_dir is set (monorepo mode), subprocess calls use it as cwd and filesystem checks are resolved relative to it. Returns True if tests pass, calls sys.exit(1) on failure.

#_run_builtin_lint

python
def _run_builtin_lint(flags, is_library=False, project_dir=None)

Run built-in library lint.

Counts errors and warnings from lint results. Exits on errors. Only runs on library projects (monorepo projects with library = true). When project_dir is set (monorepo mode), lint runs against that directory.

#_run_selfdoc_check

python
def _run_selfdoc_check(flags, project_dir=None, docs_excluded=False)

Run selfdoc check if selfdoc.json exists in the project directory.

Checks documentation consistency before releasing. Non-fatal if selfdoc is not installed; fatal if it is installed and the check fails. When project_dir is set (monorepo mode), checks are resolved relative to it. When docs_excluded is True (the "docs" target is in the release file's exclude list), the check is skipped automatically.

#_run_strictcli_schema_dump

python
def _run_strictcli_schema_dump(flags, log, version_dir='.', project_dir=None)

Run --dump-schema for strictcli projects to regenerate .strictcli/schema.json.

Detects strictcli usage via pyproject.toml, runs the entry point with --dump-schema, and logs the result. The generated file is picked up by the hook-generated file mechanism (pre/post hook dirty snapshots).

Non-fatal: a failing dump command prints a warning but does not abort.

#_sync_lockfiles

python
def _sync_lockfiles(target_paths, files_to_commit, log)

Re-sync lockfiles after version bumps so they stay consistent.

For each known lockfile found in a target directory, runs the corresponding sync command. If the lockfile is modified, its path is appended to files_to_commit so it is included in the release commit and not flagged by the unexpected-files guard.

Missing tools and sync failures are warnings, not errors.

#_update_last_build_release

python
def _update_last_build_release(version_dir, version)

Store last_build_release version in .rlsbl/config.json for OTA validation.

#run_cmd

python
def run_cmd(release_config: 'ReleaseConfig', flags: dict | None=None)

Release command handler.

Accepts a ReleaseConfig instance (from the release file) and an optional flags dict. Bumps version, commits, pushes, and creates a GitHub Release.

#_print_stale_dep_advisory

python
def _print_stale_dep_advisory(monorepo_name, new_version, version_dir)

Print advisory about downstream packages with stale constraints.

After releasing a package, checks if any workspace package that depends on the just-released package has a constraint that no longer satisfies the new version. Prints to stderr as a non-blocking advisory.

#_upload_release_assets

python
def _upload_release_assets(tag, version_dir, new_version, log, flags)

Build and upload release assets for targets with publish..assets: true.

For each detected target that has assets enabled in its publish config:

  1. Create a dist directory under .rlsbl/dist//
  2. Call target.build_assets() to build artifacts
  3. Check each artifact against max_asset_size_mb
  4. Upload via gh release upload
  5. Clean up the dist directory

Skips silently if no targets have assets enabled. Warns and skips targets whose build_assets() raises NotImplementedError.

#_run_release_mutating

python
def _run_release_mutating(registry, reg, flags, quiet, log, new_version, current_version, bump_type, tag, branch, changelog_entry, target, secondary_targets=None, monorepo_name=None, monorepo_project_path=None, version_dir='.', commit_msg=None, primary_path=None, target_paths=None, lock_dir='.rlsbl', pre_existing_dirty=None, abs_project_dir=None, hook_generated=None)

Inner release logic that runs under the advisory lock (mutating phase).