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.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 namedSQUARECLOUD_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
main now sends the repository to your application and restarts it. Two details matter:
- Keep the
actions/checkoutstep: without it the runner has no files to send. concurrencymakes two pushes in a row deploy one after the other, instead of at the same time.
Test and build before the deploy
Withinstall-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:
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 tomain 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.
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, setSQUARECLOUD_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
~/.local/bin:
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. commitnever opens a picker. Without an ID, it uses theID=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
1and change nothing. Add-yto the ones you mean. --restartalso 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> --jsonafter the deploy tells you whether the application is running. - Trace a failing run with
SQUARECLOUD_DEBUG: 1in the step’senv. It prints the method, the path, the status and the duration of each request, never headers or bodies.
Frequently asked questions
The deploy passes but the old code is still running.
The deploy passes but the old code is still running.
The commit ran without
--restart. New files only run after a restart.Can the pipeline create the application?
Can the pipeline create the application?
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 job fails with 403 MISSING_SCOPE or RESOURCE_NOT_ALLOWED.
The job fails with 403 MISSING_SCOPE or RESOURCE_NOT_ALLOWED.
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.Is the application offline during the deploy?
Is the application offline during the deploy?
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.
Related
squarecloud commit: every flag of the command.- Authentication: how the CLI reads the key.
- GitHub deploys: deploy on push without a pipeline.
- API keys and scopes: scopes and keys limited to resources.

