deploy
Deploy a repository as a new app in one call: a public one on any git host, or one of your own repos.
noclick.deploy copies the repository (or takes your repo as it is), makes the app, sets the secrets it reads,
gives it the key to your account it asks for (or has the deploy ask the account's owner), and deploys production.
Ask with dry_run=True first to see what it would do, what it would cost a month and what it asks of you, with
nothing made.
plan = noclick.deploy("https://github.com/acme/console", dry_run=True)
print(plan.runtime, f"${plan.estimate.monthly_usd:.2f} a month", plan.missing_secrets)
app = noclick.deploy("https://github.com/acme/console", secrets={"STRIPE_SECRET_KEY": "sk_live_..."}).wait()
print(app.url)function deploy(
source: string | ApiObject,
options: DeployOptions & { dryRun: true },
): Promise<DeployPlan>
function deploy(
source: string | ApiObject,
options?: DeployOptions & { dryRun?: false },
): Promise<RepoDeploy>Deploy source as a new app of yours: a public git repository's https URL, on any host (copied into a new repo
of yours, the one branch it deploys), or one of your own repos (a Repo, its id or its name, deployed as it is).
It makes the app, sets the secrets its noclick.json says its code reads (NoClick makes the ones marked
generate; secrets brings the rest), gives the app the key to your account it asks for when accountKey names
exactly its scopes (only you signed in, or a key holding keys:create; otherwise the deploy asks the account's
owner), and deploys production. Never a private repository, a URL with a login, an ssh:// or git@ address, or
another account's repo: push a private one to a repo of yours with git and deploy that. What can't deploy is
refused before anything is made. Needs the apps and repos scopes.
Resolves to a RepoDeploy whose wait() gives the live app (url, where its key stands, passwords to read once);
with dryRun: true, to a DeployPlan of what it would do, what it would cost and what it asks of you.
const plan = await deploy("https://gitlab.com/acme/tools/console", { dryRun: true });
for (const line of plan.accountKey?.can ?? []) console.log("its key can", line.can);
const done = await (await deploy("https://gitlab.com/acme/tools/console", {
secrets: { STRIPE_SECRET_KEY: "sk_live_..." },
})).wait();
const app = Project.fromId(done.projectId);
for (const name of done.toReveal) console.log(name, await app.secrets.reveal(name));Answer what it would do, with nothing made (only reading the repository is charged, its seconds).
A branch, tag or full commit sha to deploy (the repository's default branch when omitted).
The app's name (and its copy's); omitted, the repository's own, or the first of name-2, name-3... free.
Values for the secrets the repository's noclick.json asks you to set, by name. Write-only.
Give the app the key to your account it asks for, as part of the deploy: exactly its scopes, as the dry run
names them. Only you signed in, or a key holding keys:create; otherwise leave it out and the deploy asks the
account's owner.
The most the key may spend in a calendar month (none of its own unless set).
undefined = the ambient user (asUser), null = the account itself.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
A RepoDeploy operation whose wait() gives a DeployResult (the app's url, where its key
stands, the passwords to read once); with dry_run=True, a DeployPlan of what it would do, what it
would cost a month and what it asks of you, with nothing made.
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;
/** A `User` or your own id for the user. */
type UserRef = string | UserLike;
/** Anything that can name a user lazily (a `User`). */
interface UserLike {
_userId(): Promise<string>;
}DeployPlan
class DeployPlanWhat a deploy would do, with nothing made: deploy(source, { dryRun: true }).
| source | JsonObject | What it read: |
| name | string | The app's name (and its copy's): the one you gave, or the first free one from the repository's. |
| runtime | string | null | Where the app would run ( |
| framework | string | null | |
| reason | string | null | |
| noclickJson | boolean | Whether the repository has a noclick.json. |
| accountKey | DeployKeyAsk | null | |
| secrets | DeploySecret[] | |
| missingSecrets | string[] | The secrets you set that the call would have to bring: a deploy without them is refused. |
| refused | JsonObject | null | Why it won't deploy as it stands ( |
| estimate | Estimate | What it would cost a month, priced for your account (usage-based: what's charged is what's used). |
| funds | JsonObject | Whether your account can pay to run it now ( |
| makes | string[] | What it makes: |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };DeployResult
interface DeployResultA deploy that ended live: what RepoDeploy.wait() resolves to.
| projectId | string | |
| name | string | |
| url | string | null | Where production serves it. |
| repoId | string | null | |
| deploymentId | string | null | |
| commit | string | null | |
| accountKey | JsonObject | null | Where its key to the account stands ( |
| toReveal | string[] | The passwords NoClick made that nobody has read yet: read each once with |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };DeploySecret
interface DeploySecretA secret the repository's noclick.json says its code reads.
| name | string | |
| generate | string | null | What NoClick makes for it ( |
| description | string | null | What it is, in the repository's words. |
| required | boolean | For one you set: whether a deploy without it is refused. One NoClick makes is always there. |
| given | boolean | For one you set: whether the call brought its value. |
| shownOnce | boolean | For one NoClick makes: whether it's a password you read once ( |
DeployKeyAsk
interface DeployKeyAskThe key to your account the repository asks for, as you're shown it before you agree.
| scopes | string[] | |
| can | JsonObject[] | What the key can do, a line per scope ( |
| cannot | string[] | What no app's key can do, whatever it holds. |
| note | string | That whoever can change the app's code acts with the key. |
| givenBy | "you" | "deploy" |
|
| atDeploy | string | null | When the deploy asks: |
type JsonObject = { [key: string]: unknown };RepoDeploy
class RepoDeploy extends OperationA repository being deployed as a new app: the operation deploy returns. wait() resolves to a DeployResult
once it's live; progress shows each stage (copying, making the app, setting its secrets and key, building and
deploying). A deploy that fails after the copy keeps the app and its repo, and its error says how to go on.
- Inherits from Operation.
| projectId | string | null | The new app's id, once it's made. |
| repoId | string | null | The repo it deploys: the copy, or yours. |
| deploymentId | string | null | The production deployment, once it's started. |