apm publish
Synopsis
Section titled “Synopsis”apm publish [OPTIONS]Description
Section titled “Description”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:
apm experimental enable registriesThe 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.
Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
--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 PATH | auto-pack | Path to a pre-built .zip. Skips auto-pack. (renamed from --tarball in v0.20.0) |
--dry-run | off | Print what would be uploaded; do not call the registry. |
--verbose, -v | off | Show auto-pack details (archive path). |
Examples
Section titled “Examples”Auto-pack and publish when only one registry is configured:
apm publish --package acme/my-skillChoose a registry and preview first:
apm publish --package acme/my-skill --registry corp-main --dry-run -vapm publish --package acme/my-skill --registry corp-mainPublish a pre-built zip:
apm publish --package acme/my-skill --zip ./build/my-skill-0.0.1.zipPublish a package that lives on GitLab:
apm publish --package gitlab.com/acme/my-package --registry corp-mainPackage identity
Section titled “Package identity”--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.
--package | Registry 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).
Output
Section titled “Output”Successful publish
Section titled “Successful publish”[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-mainWith --verbose, auto-pack also prints:
[i] Packing flat registry archive -> my-package-1.2.3.zipDry run
Section titled “Dry run”[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)Common errors
Section titled “Common errors”| Message | Cause |
|---|---|
requires the experimental registries feature | Run apm experimental enable registries. |
apm.yml not found | Run 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 configured | Pass --registry NAME. |
Version '...' already exists ... immutable | HTTP 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 permission | HTTP 403 — check APM_REGISTRY_TOKEN_{NAME}. |
401 / credentials remediation | HTTP 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.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Published successfully, or --dry-run completed without error. |
1 | Publish 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. |
2 | Usage error: cannot infer owner/repo, multiple registries without --registry, or invalid flag combination. |
Related
Section titled “Related”- 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 withresolved_hashverification.- 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.