Skip to content

apm publish

Terminal window
apm publish [OPTIONS]

apm publish uploads a package version to a configured registry via PUT /v1/packages/{owner}/{repo}/versions/{version}.

By default the command auto-packs a flat registry archive in the project root ({name}-{version}.zip) containing apm.yml, .apm/, and standard root-level documentation files (README.md, CHANGELOG.md, LICENSE / LICENCE, matched case-insensitively) at the archive root. Symlinks are excluded. Publish refuses to build the archive when .apm/ contains a credential file (.env, .env.*, *.pem, *.key, id_rsa, id_ed25519) and names each one. This is not the plugin bundle layout from apm pack ({name}-{version}/plugin.json).

Requires the experimental registries feature:

Terminal window
apm experimental enable registries

The project’s apm.yml must declare a registries: block with at least one registry URL. Publish credentials resolve via APM_REGISTRY_TOKEN_{NAME} or apm config set registry.<name>.token. Credentials are sent only when registry.<name>.url in $APM_HOME/config.json (default ~/.apm/config.json) matches the publish destination.

FlagDefaultDescription
--registry NAME(required when multiple registries configured)Registry name from the registries: block.
--package OWNER/REPO(required)Package identity to publish as, written exactly as consumers write the registry dependency’s id: (e.g. acme/my-skill or gitlab.com/acme/my-skill). See Package identity. Normalized to lowercase.
--zip PATHauto-packPath to a pre-built .zip. Skips auto-pack. (renamed from --tarball in v0.20.0)
--dry-runoffPrint what would be uploaded; do not call the registry.
--verbose, -voffShow auto-pack details (archive path).

Auto-pack and publish when only one registry is configured:

Terminal window
apm publish --package acme/my-skill

Choose a registry and preview first:

Terminal window
apm publish --package acme/my-skill --registry corp-main --dry-run -v
apm publish --package acme/my-skill --registry corp-main

Publish a pre-built zip:

Terminal window
apm publish --package acme/my-skill --zip ./build/my-skill-0.0.1.zip

Publish a package that lives on GitLab:

Terminal window
apm publish --package gitlab.com/acme/my-package --registry corp-main

--package uses the same identity as apm install and the Registry HTTP API: the last part is {repo} and everything before it, including any host, is {owner}. A leading https:// is dropped; the host is kept.

--packageRegistry path
acme/my-skill/v1/packages/acme/my-skill/...
gitlab.com/acme/my-skill or https://gitlab.com/acme/my-skill/v1/packages/gitlab.com%2Facme/my-skill/...
github.com/acme/my-skill/v1/packages/github.com%2Facme/my-skill/...

A host is part of the identity, so acme/my-skill and github.com/acme/my-skill are different packages. Publish with the same string consumers put in id: (a consumer writing id: acme/my-skill requests acme/my-skill).

[i] Publishing acme/my-package@1.2.3 to corp-main...
[+] Published acme/my-package@1.2.3
digest : sha256:abc123...
published_at: 2026-05-26T10:15:00Z
registry : https://registry.example.com/apm/corp-main

With --verbose, auto-pack also prints:

[i] Packing flat registry archive -> my-package-1.2.3.zip
[i] Would publish acme/my-package@1.2.3 to corp-main (https://registry.example.com/apm/corp-main)
[i] archive : /path/to/project/my-package-1.2.3.zip (12,345 bytes)
[i] (dry-run -- nothing uploaded)
MessageCause
requires the experimental registries featureRun apm experimental enable registries.
apm.yml not foundRun from the package root.
requires a flat APM package (.apm/ directory)Add .apm/ or pass --zip.
Refusing to pack N credential file(s)Remove the named files from .apm/, then publish again.
Multiple registries configuredPass --registry NAME.
Version '...' already exists ... immutableHTTP 409 — bump version: in apm.yml.
Registry rejected the package (validation failed)HTTP 422 — archive layout invalid for the server.
Forbidden -- your token does not have publish permissionHTTP 403 — check APM_REGISTRY_TOKEN_{NAME}.
401 / credentials remediationHTTP 401 — token missing or expired.

Some registries return 201 with an empty body; APM still treats the upload as successful when the HTTP status is success-class.

CodeMeaning
0Published successfully, or --dry-run completed without error.
1Publish failure: missing apm.yml or .apm/, invalid manifest, auth error (401/403), version conflict (409), server validation rejection (422), unknown --registry name, no registries: block, network/registry error, registries feature disabled, or other unhandled error.
2Usage error: cannot infer owner/repo, multiple registries without --registry, or invalid flag combination.
  • Registries (guide) — declare registries, auth, default routing, and policy.
  • apm pack — plugin bundles and marketplace artifacts (different layout from registry publish).
  • apm install — consumer side; installs registry packages with resolved_hash verification.
  • Registry HTTP API — wire contract for PUT .../versions/{version}.

Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.