Skip to content

feat(pack): --create-tag and --push flags to create and push release tag after --check-versions #1489

@danielmeppiel

Description

@danielmeppiel

Summary

Add --create-tag and --push flags to apm pack. When
--check-versions succeeds, --create-tag creates the git tag the
check is verifying (e.g. v1.2.0 for lockstep marketplaces, or one
per package for per_package). --push follows up by pushing the
created tag to the configured remote. Refuses to operate on a dirty
working tree, on existing tags, or when the manifest version and the
tag-to-create disagree.

Motivation

The current release dance for a marketplace looks like this:

  1. Bump marketplace.yml version.
  2. apm pack --check-versions --check-clean (release gates).
  3. Inspect output.
  4. git tag v1.2.0.
  5. git push origin v1.2.0.
  6. Wait for the marketplace consumers to pick up the new tag.

Steps 4 and 5 are mechanical and error-prone: tag-name typos, forgotten
push, or pushing the wrong commit (e.g. when the local HEAD has
unrelated drift from origin/main). The proposal folds the mechanical
steps into the gated command itself, so the release is one invocation
instead of three, and any failure unwinds cleanly.

Proposal

Two new flags on apm pack:

  • --create-tag — after --check-versions succeeds, create the git
    tag(s) implied by the marketplace's versioning strategy:

    Tag creation is annotated (git tag -a -m "Release v1.2.0") and
    signed if tag.gpgSign is set in git config.

  • --push — after creating tags, push them to the remote inferred
    from git config branch.<current>.remote (default origin). Only
    pushes the newly created tags; never pushes branches.

Both flags require --check-versions to also be set (the version
agreement check is the gate that justifies tag creation).
--push may be used with or without --create-tag, but without
--create-tag it errors out (no tag was made; nothing to push).

Refusal conditions (all exit code 1, distinct messages):

  1. Working tree is dirty.
  2. Tag(s) already exist locally or on the remote.
  3. Manifest's marketplace version disagrees with the tag-to-create.
  4. No git remote configured.
  5. --check-versions not passed.

Examples

One-shot release:

apm pack --check-versions --check-clean --create-tag --push

Inspection (dry-run; reports tags that would be created and pushed,
makes no git calls):

apm pack --check-versions --create-tag --push --dry-run

Tag locally, push manually later:

apm pack --check-versions --create-tag
git push origin --tags

Considerations

  • Composes with --check-clean: when both gates run and both pass,
    tag creation runs.
  • Composes with --dry-run: dry-run never invokes git.
  • Composes with --json: success/failure of tag creation and push
    are added to the existing JSON output envelope under
    tag_creation and tag_push keys.
  • The flag pair refuses to run if apm pack is operating in
    bundle-only mode (no marketplace: block) — tag-on-bundle has no
    natural single-version source.

Out of scope

  • Releasing to a non-origin remote via flag. Use git config first.
  • GPG configuration help; users wire their own gpgSign.
  • Creating tags via the GitHub API instead of git push — keeps the
    command's only side effect inside the local git repo + the user's
    configured remote.
  • Per-package tag-pattern overrides surfaced via flag; those already
    live in marketplace.yml under tagPattern.

References

Related (same surface, orthogonal problems)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCLI command surface, flags, help text (cross-cutting).area/package-authoringapm pack/unpack, plugin authoring, vendoring guidance, bundle format.status/needs-triageNew, awaiting maintainer review.theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.type/featureNew capability, new flag, new primitive.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions