Skip to content

Scripts ​

Every project has customizable shell scripts that run at fixed points in the deployment process:

  • Before build - Runs before the application is built. Use it to change the application code before the build starts.
  • After build - Runs once the application has been built. Use it for cleanup or configuration tasks.

Scripts belong to the project, so they run for the deployments of all of its environments. Test changes to a script before deploying to production.

Edit scripts ​

  1. Open your project and navigate to the Scripts tab.
  2. Edit the content of the Before build and/or After build script.
  3. Click the "Update scripts" button to apply the changes.
The Scripts tab with a Before build and an After build script

The scripts run with the next deployment of any of your environments. Leave a field empty to skip a script.

How scripts are run ​

Both scripts run with bash in the build container, with your application code in /opt/build. The After build script runs after the build and before the deployment, not on your running environment.

If a script exits with a non-zero code, the deployment fails. The output is shown in the deployment log.

Longer scripts ​

For longer or more complex logic, add a script file to your repository and call it from the project script, e.g. bash scripts/pre-build.sh. This keeps the logic versioned alongside your code.