Automating Deployments


Track deployments to understand how changes impact performance. Deploys allow you to see timeline markers for code deployments.

Create deploy#

Create Deploys

To create a deploy you will need your site-slug and either your site-secret or an API Token with permissions to create deploys.

Your site-slug and site-secret can be found on the Site → Settings → General page, or retrieved via API.

Site settings showing the Site slug and Site secret fields

You can create deploys with the CLI, Node.js API, HTTP Site API or GraphQL API.

calibre site create-deploy \
	--site=$SITE_SLUG \
	--revision=$REVISION \
	--repository=$REPOSITORY \
	--username=$USERNAME
Example Response#
 Deploy created: cddd1ae9-4af3-4f0e-b9d5-8e26b7848ae3
ParameterRequiredDescription
siteYesThe site slug
revisionYesThe revision identifier (e.g. commit SHA or version number)
repositoryNoThe repository URL
usernameNoThe username of the person who triggered the deploy
createdAtNoThe timestamp of the deploy (ISO 8601 format)

List deploys#

Read Sites

You can list deploys with the CLI, Node.js API, HTTP Site API or GraphQL API.

calibre site deploys \
	--site=<site> \
	--count=<count> \
	--cursor=<cursor>

Delete deploy#

Delete Deploys

You can delete a deploy with the CLI, Node.js API or GraphQL API.

calibre site delete-deploy \
	--site=<site> \
	--uuid-<uuid> \
	--confirm

Retrieve deploy#

You can retrieve a deploy with the HTTP Site API.

HTTP Site API
curl -X GET -H "Accept: application/json" \
https://calibreapp.com/api/sites/<site>/deploys/<uuid>?secret=<secret>

Heroku deployment tracking#

You can track deploys using Heroku release phases.

Tip

The following example expects that Node.js is installed on your Heroku dyno.

You can add a release phase by updating Procfile to include a release command:

web: node index.js
release: scripts/heroku-release.sh

Then, in scripts/heroku-release.sh, add the following:

#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

echo "Marking the deployment in Calibre"
npx --yes calibre site create-deploy \
	--site=calibre \
	--revision="$HEROKU_SLUG_COMMIT" \
	--repository="https://github.com/calibreapp/app"

echo "Creating a snapshot in Calibre"
npx --yes calibre site create-snapshot \
	--site=calibre \
	--ref="$HEROKU_SLUG_COMMIT"

Finally, update your Heroku application pipeline to include a CALIBRE_API_TOKEN environment variable. You can learn how to generate a token on the API Tokens page.

On this page