vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
  • bugs
  • build
  • cache
  • ci
  • config
  • create
  • deploy
  • docs
  • exec-cache
  • exec-local
  • exec
  • help
  • init
  • install
  • list
  • login
  • logout
  • outdated
  • pack
  • ping
  • pkg
  • publish
  • query
  • registry
  • repo
  • run-exec
  • run
  • setup
  • skills
  • stage
  • token
  • trust
  • uninstall
  • update
  • version
  • view
  • whoami
  • Subcommands
  • github
  • list
  • revoke
  • Output
  1. Client
  2. /
  3. Commands
  4. /
  5. trust

vlt trust

Usage:

Terminal
$ vlt trust github [<pkg>] --file=<workflow> [--repository=<owner/repo>] [--environment=<name>] [--allow-publish] [--allow-stage-publish]
$ vlt trust list [<pkg>]
$ vlt trust revoke [<pkg>] --id=<trust-id>

Manage the CI workflows trusted to publish a package.

A trusted publisher is a CI workflow the registry lets publish a package with no stored token: the job swaps its identity token for a short-lived registry token. Add one with vlt trust github; Trusted publishing covers the rest of the setup.

<pkg> defaults to the name of the package in the current directory. A version or range (<pkg>@1.0.0) is ignored.

The registry is the publishConfig.registry of the package in the current directory when that package is <pkg>, else --registry, a registry picked by alias with vlt registry <alias> trust <subcommand>, or the configured registry.

Subcommands

github

Trust a GitHub Actions workflow to publish a package.

Terminal
$ vlt trust github [<pkg>] --file=<workflow> [--repository=<owner/repo>] [--environment=<name>] [--allow-publish] [--allow-stage-publish]
  • --file=<workflow>: the name of the workflow file in .github/workflows, such as release.yml. It must end in .yml or .yaml and be a file name, not a path.
  • --repository=<owner/repo> (alias --repo): the GitHub repository of the workflow. It defaults to the repository of the package in the current directory, when that package is <pkg> and the URL is a GitHub one.
  • --environment=<name>: the GitHub environment the job of the workflow must run in. Optional.
  • --allow-publish lets the workflow run vlt publish, and --allow-stage-publish (alias --allow-staged-publish) lets it run vlt stage publish. At least one of the two is required.

Only an owner or admin can add a trusted publisher, signed in as themselves, not with a service token. The registry asks for a second factor: pass --otp=<code>, or vlt opens the browser sign-in, as it does when a publish needs one.

vlt shows the trusted publisher it is about to create and asks Do you want to proceed? (y/N). Any answer but y or yes cancels. --yes skips the question, and is required where there is no terminal to answer in.

Terminal
$ vlt trust github @acme/utils --file=release.yml --repository=acme/utils --environment=production --allow-publish --allow-stage-publish --yes
Terminal
🀝 Trusted publisher created for @acme/utils:
type: github
id: 3f2a1c9e-8b7d-4e6f-9a0b-1c2d3e4f5a6b
file: release.yml
repository: acme/utils
environment: production
permissions: publish, stage publish

With --dry-run, nothing is asked or sent: it prints the trusted publisher that would be created, which has no id yet.

list

List the trusted publishers of a package. Alias: ls.

Terminal
$ vlt trust list [<pkg>]

Each trusted publisher prints as a branch of key: value lines, starting with its id:

Terminal
β”œβ”€ 🀝 id: 3f2a1c9e-8b7d-4e6f-9a0b-1c2d3e4f5a6b
β”‚    type: github
β”‚    file: release.yml
β”‚    repository: acme/utils
β”‚    environment: production
β”‚    permissions: publish
β”‚
└─ 🀝 id: 7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f
type: github
file: stage.yml
repository: acme/utils
permissions: stage publish

file is the workflow file and environment, when set, the environment its job must run in. permissions says what the workflow may run: publish for vlt publish, stage publish for vlt stage publish.

With none, it prints No trusted publishers found.

revoke

Remove a trusted publisher, by the id vlt trust list printed. It takes effect at once: the workflow's next publish is refused.

Only an owner or admin can revoke, signed in as themselves, not with a service token. The registry asks for a second factor: pass --otp=<code>, or vlt opens the browser sign-in, as it does when a publish needs one.

Terminal
$ vlt trust revoke [<pkg>] --id=<trust-id>
Terminal
Revoked trusted publisher 3f2a1c9e-8b7d-4e6f-9a0b-1c2d3e4f5a6b of @acme/pkg.

With --dry-run, nothing is sent:

Terminal
Would revoke trusted publisher 3f2a1c9e-8b7d-4e6f-9a0b-1c2d3e4f5a6b of @acme/pkg (dry run).

Output

With --view=json, list prints an array of trusted publishers ([] with none), each with the fields above and permissions as an array of the registry's names, createPackage and createStagedPackage. github prints the trusted publisher it created as one such object with a package field first, and without id under --dry-run. revoke prints { "package": "<pkg>", "id": "<trust-id>", "revoked": true }, with "revoked": false under --dry-run.


Previous: tokenPrevious pageNext: uninstallNext page

On this page

  • Subcommands
  • github
  • list
  • revoke
  • Output
Edit this page

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now