Skip to main content
A deploy from a pipeline is one command: squarecloud commit <appID> --restart. It zips the checked-out folder, sends it to an application that already exists and restarts it. This page shows how to run it from GitHub Actions, from any other CI and without the CLI.
A pipeline updates an application, it doesn’t create one. Create the application first, with the quickstart, and copy its ID from the dashboard or from squarecloud app list.
Prefer no pipeline at all? GitHub deploys link a repository to the application, and every push deploys by itself. Use a pipeline when the deploy depends on something else: tests, a build, a release, several applications.

Create a key for the pipeline

Don’t reuse your personal key. In the dashboard, open Account → Security and create a key only for this repository: Add envs:write if the pipeline also sets environment variables, and apps:read if it reads the status or the logs. The scopes table lists what each one allows. Store the key as a secret of your CI, never in the repository. With one key per repository, you can revoke one without stopping the others.

GitHub Actions

Save the key as a repository secret named SQUARECLOUD_API_KEY and the application ID as a repository variable named SQUARECLOUD_APP_ID (Settings → Secrets and variables → Actions). Then add this workflow:
.github/workflows/deploy.yml
Every push to main now sends the repository to your application and restarts it. Two details matter:
  • Keep the actions/checkout step: without it the runner has no files to send.
  • concurrency makes two pushes in a row deploy one after the other, instead of at the same time.
The official action installs the CLI on the runner, checks the download against the release checksums, masks the key in the logs and runs the command. Its inputs:

Test and build before the deploy

With install-only, the CLI stays available to the following steps. The deploy runs only if the tests and the build pass, and the built files go up with the commit:
Check that squarecloud.ignore doesn’t leave out the build folder (dist, .next, build), or the application starts without it.

Staging and production

One workflow, two applications: pushes to main go to production and pushes to develop go to staging.

Several applications in one repository

Each folder is its own application, with its own configuration file. fail-fast: false keeps one failed deploy from cancelling the others, and max-parallel keeps the uploads under the rate limit.

Environment variables from secrets

Keep tokens in GitHub secrets and send them to the application before the commit. env set changes only the variables it lists, and the restart after the commit loads them. The key needs the envs:write scope.
Passing the secret through env, instead of writing ${{ secrets.DISCORD_TOKEN }} in the command, keeps its value out of the script GitHub runs.

Any other CI

Everywhere else the recipe is the same: install the CLI, set SQUARECLOUD_API_KEY and run the commit. In GitLab CI, with the key and the application ID saved as masked CI/CD variables:
.gitlab-ci.yml
On an image without Node.js, use the install script instead, which puts the CLI in ~/.local/bin:
The CLI reads the key from the SQUARECLOUD_API_KEY variable, so there is no login step and nothing is written to the runner’s disk.

Without the CLI

The same deploy is two API calls: a commit with the zip, then a restart.
-f makes curl exit with an error on any 4xx or 5xx answer, so a refused commit fails the job. The zip is your responsibility here: squarecloud.ignore is only read by the CLI and the VS Code extension. The limit is 100 MB.

How the CLI behaves in a pipeline

  • Any failure exits with code 1, so a failed deploy fails the job. Check the exit code, not the text.
  • commit never opens a picker. Without an ID, it uses the ID= line of the configuration file in the folder, and stops when there is none.
  • Confirmations fail closed. Commands that delete or replace data ask for confirmation, and without a terminal they exit with code 1 and change nothing. Add -y to the ones you mean.
  • --restart also starts an application that was stopped. Without it, the new files only run after the next restart.
  • Pace your commits. An application accepts one commit every 5 seconds, and an account one every 2 seconds. A faster one answers 429.
  • Parse --json, not the tables: squarecloud app status <appID> --json after the deploy tells you whether the application is running.
  • Trace a failing run with SQUARECLOUD_DEBUG: 1 in the step’s env. It prints the method, the path, the status and the duration of each request, never headers or bodies.
More in Global flags and CI.

Frequently asked questions

The commit ran without --restart. New files only run after a restart.
It can, with squarecloud upload, but each run would create one more application. Create it once by hand and let the pipeline commit to it.
The key lacks a scope the command needs, or the application is not in the key’s resources. Scopes can’t be edited on an existing key: create a new one with apps:deploy and apps:control and replace the secret.
For the time of the restart, yes. To keep a website answering, put two applications behind a load balancer and deploy one at a time.