# Run a command after each deploy

A post-deploy command runs once the new version is live, for cache purges, notifications or warm-up tasks.

Canonical URL: https://unbroker.cloud/changelog/2026-10-26-post-deploy-command
Published: 2026-10-26
Tags: Apps

## Related reading

- [Cloud Apps](https://unbroker.cloud/deploy)
- [Deploy from Git](https://docs.unbroker.cloud/guides/deploy-from-git)

Repository services can run one command after a deployment goes live, such as purging a CDN cache or notifying another system. Set it in the service settings under **Build & Deploy**.

The command runs in a one-off copy of the new image, with the service's environment variables, for up to 10 minutes. Its output is appended to the deployment log.

- It starts only after the new version is serving traffic, so a failure never takes the release down. The deployment stays live and is marked with a failed post-deploy step.
- It does not run when the deploy itself fails, and nothing is rolled back.
- Long environment values are masked in the log, and the command itself is not printed. Keep secrets in variables, not in the command.
- Static sites copy their `scripts` folder to `/opt/unbroker/scripts`, outside the published files, so a script can call an API without being served.

Post-deploy commands require a paid plan and are not available for image services. See [Post-deploy command](https://docs.unbroker.cloud/cli/deployments#post-deploy-command).
