Deploy hooks
Every image and Git service has a secret deploy hook URL. A POST request to it deploys the service, just like the Deploy button. Call it at the end of your CI pipeline, after tests and linting pass.
- A Git service builds the newest commit of its branch.
- An image service pulls its tag again. Push the new image under the same tag first.
The hook deploys the service's saved settings and environment variables, including changes that haven't been deployed yet.
Get the URL
Open the service's Settings tab. The Deploy hook card shows the URL and a ready-made command:
curl --fail -X POST https://harblet.example.com/api/hooks/2f1c9e4a-7b3d-4e8f-9a61-0c5d8e7f3b12
Call it from your pipeline
Add the URL as a repository secret named HARBLET_DEPLOY_HOOK, then add a step at the end of your workflow:
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm test
- name: Deploy to Harblet
run: curl --fail -X POST "${{ secrets.HARBLET_DEPLOY_HOOK }}"
Add the URL as a masked CI/CD variable named HARBLET_DEPLOY_HOOK, then add a job:
deploy:
stage: deploy
image: curlimages/curl
script:
- curl --fail -X POST "$HARBLET_DEPLOY_HOOK"
rules:
- if: $CI_COMMIT_BRANCH == "main"
Responses
| Status | Meaning |
|---|---|
201 | The deployment started. The body holds its id and its status: queued, building or deploying. |
500 | The deployment failed to start. |
400 | The URL is incomplete or mistyped, for example a character got lost when copying it. |
404 | No service has this deploy hook. The URL may have been regenerated. |
curl --fail exits with an error on any status from 400 up, so your pipeline fails when the deployment can't start.
{ "id": "019a8f3c-5b2d-7e41-9c3a-2d4b6e8f0a1c", "status": "building" }
Several calls in a row
The hook follows the same rules as the Deploy button: a service runs one deployment at a time, and a newer queued deployment replaces an older one. Since every build takes the newest commit of the branch, several pushes in a row end on the newest commit.
The request body is ignored, and only POST deploys. Opening the URL in a browser doesn't.
Regenerate the URL
If the URL leaked, click Regenerate on the Deploy hook card and confirm. The old URL stops working right away, so update the secret in your pipelines.