Publish packages that have been tagged for release in the current commit To perform a test run use `--dry-run= -v ` to specify a comma-separated list of tags to simulate a release of. For example, to simulate a release of `@foo/bar-v1.2.3` and `baz-v4.5.6` use `--dry-run=@f
(context: Context, dry_run: str = "")
| 205 | |
| 206 | @task |
| 207 | def publish(context: Context, dry_run: str = ""): |
| 208 | """Publish packages that have been tagged for release in the current commit |
| 209 | |
| 210 | To perform a test run use `--dry-run=<name>-v<version>` to specify a comma-separated |
| 211 | list of tags to simulate a release of. For example, to simulate a release of |
| 212 | `@foo/bar-v1.2.3` and `baz-v4.5.6` use `--dry-run=@foo/bar-v1.2.3,baz-v4.5.6`. |
| 213 | """ |
| 214 | packages = get_packages(context) |
| 215 | |
| 216 | release_prep: dict[LanguageName, ReleasePrepFunc] = { |
| 217 | "js": prepare_js_release, |
| 218 | "py": prepare_py_release, |
| 219 | } |
| 220 | current_tags = dry_run.split(",") if dry_run else get_current_tags(context) |
| 221 | parsed_tags = [parse_tag(tag) for tag in current_tags] |
| 222 | |
| 223 | publishers: list[Callable[[bool], None]] = [] |
| 224 | for tag_info in parsed_tags: |
| 225 | if tag_info.name not in packages: |
| 226 | msg = f"Tag {tag_info.tag} references package {tag_info.name} that does not exist" |
| 227 | raise Exit(msg) |
| 228 | |
| 229 | pkg_info = packages[tag_info.name] |
| 230 | if pkg_info.version != tag_info.version: |
| 231 | msg = f"Tag {tag_info.tag} references version {tag_info.version} of package {tag_info.name}, but the current version is {pkg_info.version}" |
| 232 | raise Exit(msg) |
| 233 | |
| 234 | log.info(f"Preparing {tag_info.name} for release...") |
| 235 | publishers.append(release_prep[pkg_info.language](context, pkg_info)) |
| 236 | |
| 237 | for publish in publishers: |
| 238 | publish(bool(dry_run)) |
| 239 | |
| 240 | |
| 241 | # --- Utilities ------------------------------------------------------------------------ |
nothing calls this directly
no test coverage detected