Publish an app
publish_appPublish source as an app: a process Valet builds from your files and runs behind its own URL. Use it when the work needs a server, a background process, or a database. A Procfile at the root says how to start each process type; the web type serves the app's URL and must listen on $PORT, which Valet sets. Node, Python, and Go are supported. Apply the governance skill before calling.
title and description are required and a call missing either is refused: Valet writes the app's valet.yaml from them, and any valet.yaml in files is replaced. Content is text: source files, lockfiles, Procfile, configuration. Images and other binary assets are not supported on this surface. Dependencies are installed during the build from the manifest you publish: package.json, with its lockfile when you have one; requirements.txt; or go.mod, where go.sum is optional and the build completes it. Do not include installed packages.
Publishing to a name that exists replaces its source with these files, so read get_source first when the app is not yours. The publish returns a build id. Poll get_build until deploy_state is up or crashed; the first deploy can take a few minutes. A build that succeeded is not yet live: its processes still have to start on the new release. On crashed, a web process that had a running release keeps serving it, so a working URL does not prove the new release is live; other crashed processes are down until fixed. Read each crashed process's state_reason: if it is the app's own output, fix the code and publish again; if it names a platform or configuration failure, fix that or publish again. The first publish creates the app, so set environment variables and attach resources after it: set_env_vars and attach_resource each restart the app with its new variables. Write the app to start without them and serve a page saying what is missing, never exiting, and give the user the URL once its resources are attached. A new app is private: only members of the organization that owns it can open it, after signing in to Valet. Use set_service_access to make it public or password-protected. Requires connecting a Valet account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Required. The app's name, which becomes the first label of its URL. Naming an app that exists republishes it. | |
| files | Yes | Required. The app's files, [{path, content}]. A Procfile at the root is required. | |
| title | Yes | Required. What the app is called, written for a person. | |
| org_name | No | The Valet organization to publish into. Omit to use the organization the account joined first. | |
| description | Yes | Required. One sentence saying what the app does. | |
| discard_draft | No | Set true to discard an open draft on this app that another session left. Omit to be told about it instead. | |
| idempotency_key | No | An opaque key of your choosing. Repeating a call with the same key returns the first call's result instead of starting a second build. Use a new key for new files: a repeated key returns the earlier result even when the files changed. |