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 with files 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 in files. Dependencies are installed during the build from the manifest you publish: package.json, with a lockfile only as the dependencies skill says; requirements.txt; or go.mod, where go.sum is optional and the build completes it. Do not include installed packages.
Send the app one of two ways. files carries the source in the call, which works from any client. push: {id, commit} publishes a commit you pushed with git: call create_push, run the recipe it returns, then pass the push_id and the commit sha it prints. Use push when you can run git with network access, when the app is large or holds binary files, or when you changed a clone of its source; the app's own valet.yaml and Procfile come from the commit. Pass files or push, not both.
Publishing changes an app that exists: create it first with create_service (kind: app), then publish to its name. A name that holds no app is refused. Publishing replaces the app's source with these files, so read get_source first when the app is not yours. The publish returns a build id. Poll get_build every ten to fifteen seconds until deploy_state is up, crashed, or refused, and between polls tell the person what its phase says the build is doing, such as running npm install or starting the app's processes; checking means the release waits for the organization's release policies. 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. Set environment variables and attach resources once the app exists. set_env_vars restarts the app with its new variables. attach_resource takes the app's own variables too and applies them and the resource's in one restart, so an app that needs both gets them in one attach_resource call. 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 is the first label of its URL. The app must exist: create it first with create_service. Publishing to it replaces its source. | |
| push | No | Publish a Git push instead of files: the id create_push returned and the commit you pushed to its branch. Use it when you can run git with network access, because it sends only what changed. Pass files or push, not both; every other argument keeps its meaning. | |
| files | No | Required unless push is given. The app's files, [{path, content}]. A Procfile at the root is required. | |
| title | No | Required with files. 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 | No | Required with files. 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. Not used with push. | |
| 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. |