Skip to content
Latchkey

How to Send a Webhook on Deploy

A deploy webhook POSTs the version and environment to downstream systems once a deploy succeeds.

Add a final step, gated on success, that POSTs a small JSON body to the receiver with the version, environment, and commit SHA.

Steps

  • Add a final step gated on if: success().
  • POST a JSON body with version, environment, and SHA.
  • Sign the body so the receiver can verify it (see the HMAC guide).

Workflow

.github/workflows/deploy.yml
steps:
  - run: ./deploy.sh
  - name: Notify on deploy
    if: success()
    run: |
      curl -X POST -H 'Content-type: application/json' \
        --data '{"env":"production","sha":"${{ github.sha }}","version":"${{ github.ref_name }}"}' \
        ${{ secrets.DEPLOY_WEBHOOK_URL }}

Gotchas

  • Gate on success so a failed deploy does not announce itself as shipped.
  • Sign the payload so the receiver can verify it rather than trusting the URL alone.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →