Deploy with custom scripts

2 minute read

Using a custom script

A custom script deployment is useful if your deployment requires additional or custom commands that are not available with some of CodeShip’s integrated deployment options.

A custom script deployment is also useful when you need to execute another task after or prior to a deployment. For example:

# Execute rake tasks bundle exec rake my_rake_task # Run additional tests # my_test_script.sh lives in the root folder ./my_test_script.sh # Deploy to Amazon S3 or any other server with ssh access # You can define your keys with environment variables

When using a single test pipeline, the same build container is used for the entire build and deploy so any configuration done during the setup and testing phase will also be present for the deployment phase. When using multiple test pipelines, a new container is used for the deploy and setup commands do not run again. If your deployment has any specific dependencies you will want to include those commands with your deployment steps.

Please follow these steps to create a custom deployment script:

Step 1

Navigate to your project’s deployment configuration page by selecting Project Settings on the top right side of the page. Next, select the Deploy tab.

Project Settings Deployment

Step 2

Edit an existing deployment pipeline or create a new deployment pipeline by selecting + Add new deployment pipeline. Create the deployment pipeline to match the exact name of your deployment branch or a wildcard branch.

Create branch deploy

Step 3

Select Custom Script

Select Custom Script

Step 4

Insert your deployment commands in the Deployment Commands box shown below. Then click Create Deployment to save your custom deployment script.

Create Custom Script

Success!

Custome Deployment Success

You have now successfully created a custom deployment script. Go ahead and push a commit to your configured deploy branch.