Automating Deployments


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

Create deploy

Required API Permission: Create Deploys

To create deploys as part of your continuous integration or deployment system, add revision, repository and username details:

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

1calibre site create-deploy --site=<site> --revision=<revision> \
2--repository=<repository> --username=<username>
Example Response
1✔ Deploy created: cddd1ae9-4af3-4f0e-b9d5-8e26b7848ae3
ParameterRequiredDescription
siteYesSite slug, found in site settings
revisionNoSource control revision id of the code being deployed (e.g. git hash or tag name)
repositoryNoBase URL of the repository containing the source code being deployed (e.g. https://github.com/calibreapp/app)
usernameNoName of the user who deployed the code
createdAtNoThe ISO8601 timestamp when the deploy was created

List deploys

Required API Permission: Read Sites

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

1calibre site deploys--site=<site> --count=<count> --cursor=<cursor>
Example Response
15 deploys
2UUID | REVISION | REPOSITORY | USERNAME | CREATED
36725fd7d-1102-430f-a9fe-654bae14e1b3 | v30 | https://github.com/calibreapp/app | Deployer | 10:00pm 12-Jul-2019
4e6027c27-ebc5-4172-8412-5fe37e23a12e | v29 | https://github.com/calibreapp/app | Deployer | 8:00pm 11-Jul-2019
5ffd67e01-8e76-424d-9688-160b63396aec | v28 | https://github.com/calibreapp/app | Deployer | 12:00pm 10-Jul-2019
642324d05-3e7d-4dd9-be7b-370af03ec1eb | v27 | https://github.com/calibreapp/app | Deployer | 6:00pm 9-Jul-2019
7badd5ad0-932a-424b-a075-d3319650856d | v26 | https://github.com/calibreapp/app | Deployer | 1:00am 9-Jul-2019
8To see deploys after v26, run: calibre site deploys --site=calibre --cursor=Nw
ParameterRequiredDescription
siteYesSite slug, found in site settings
countNoThe number of records to return, maximum: 500
cursorNoThe cursor to fetch records after

Delete deploy

Required API Permission: Delete Deploys

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

1calibre site delete-deploy --site=<site> --uuid-<uuid> --confirm
Example Response
1✔ Deploy deleted: e68302fb-b6e4-4b9c-ae7f-47c8ea6450a3
ParameterRequiredDescription
siteYesSite slug, found in site settings
uuidYesThe uuid of the deploy

Retrieve deploy

You can retrieve a deploy with the HTTP Site API.

1curl -X GET -H "Accept: application/json" \
2https://calibreapp.com/api/sites/<site>/deploys/<uuid>?secret=<secret>
Example Response
1{
2 "uuid": "badd5ad0-932a-424b-a075-d3319650856d",
3 "organisation_id": "calibre",
4 "site_id": "calibre",
5 "revision": "v26",
6 "repository": "https://github.com/calibreapp/app",
7 "username": "Deployer",
8 "html_url": "https://calibreapp.com/calibre/calibre/deploys/e68302fb-b6e4-4b9c-ae7f-47c8ea6450a3",
9 "url": "https://calibreapp.com/api/sites/calibre/deploys/e68302fb-b6e4-4b9c-ae7f-47c8ea6450a3.json",
10 "created_at": "2019-07-17T23:02:39.212Z"
11}
ParameterRequiredDescription
siteYesSite slug, found in site settings
uuidYesThe uuid of the deploy

Heroku deployment tracking

You can track deploys with Heroku's free deploy hooks addon. To add a deploy hook, install the Heroku CLI and run the following command:

1heroku addons:adddeployhooks:http \
2--app <app> \
3--url="https://calibreapp.com/api/sites/<site>/deploys?secret=<secret>&revision=[head]&username=[user]&repository=<repository>"

You should replace the following with your own values:

ParameterRequiredDescription
appYesThe name of your Heroku app
siteYesSite slug, found in site settings
repositoryNoBase URL of the repository containing the source code being deployed (e.g. https://github.com/calibreapp/app)

Related Articles