Deploy from GitHub
3 min read
The teploy CLI can automatically deploy your app when you push to a branch. No PaaS git integration required -- just a webhook.
Set up auto-deploy
From your project directory (where teploy.yml lives):
teploy autodeploy setup --branch mainThis installs a lightweight webhook listener on your server and configures a Caddy route for it. The output includes the webhook URL:
Auto-deploy configured for myapp
Webhook URL: https://myapp.com/teploy-webhook/myapp
Branch: main
Add this URL to your Git provider's webhook settings (push events only).Configure your Git provider
GitHub
- Go to your repository Settings > Webhooks
- Click Add webhook
- Set Payload URL to the webhook URL from the setup output
- Set Content type to
application/json - Set Secret to the generated secret printed by setup (or the value passed with
--secret) - Select Just the push event
- Click Add webhook
GitLab
- Go to your project Settings > Webhooks
- Set URL to the webhook URL
- Check Push events
- Click Add webhook
Bitbucket
- Go to your repository Settings > Webhooks
- Click Add webhook
- Set URL to the webhook URL
- Select Repository push trigger
- Click Save
Webhook security
Every webhook listener requires a secret. Teploy generates and prints a strong one when you do not provide it yourself. To supply a specific value instead:
teploy autodeploy setup --branch main --secret my-webhook-secretSet the same secret in your Git provider's webhook configuration. The webhook listener validates the HMAC signature on every request.
Check auto-deploy status
teploy autodeploy statusAuto-deploy: active (running)
Webhook URL: https://myapp.com/teploy-webhook/myappRemove auto-deploy
teploy autodeploy removeThis stops the webhook listener and removes the Caddy route.
Preview environments
Deploy any branch to a temporary preview URL:
teploy preview deploy feature-login --ttl 72hThe preview gets its own container and subdomain:
https://feature-login.myapp.comManage previews:
teploy preview list # list active previews
teploy preview destroy feature-login # tear down a preview
teploy preview prune # remove all expired previewsPreviews auto-expire after the TTL (default: 72 hours).
CI/CD pipelines
For more control, call teploy deploy directly from your CI pipeline instead of using webhooks.
GitHub Actions
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install teploy
run: |
curl -fsSLO https://github.com/useteploy/teploy-cli/releases/latest/download/teploy_linux_amd64.tar.gz
curl -fsSLO https://github.com/useteploy/teploy-cli/releases/latest/download/checksums.txt
grep " teploy_linux_amd64.tar.gz$" checksums.txt > checksum.txt
sha256sum -c checksum.txt
tar xzf teploy_linux_amd64.tar.gz
sudo mv teploy /usr/local/bin/
- name: Deploy
run: teploy deploy
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}Pre-built image pipeline
Build in CI and deploy the image:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t ghcr.io/myorg/myapp:${{ github.sha }} .
- run: docker push ghcr.io/myorg/myapp:${{ github.sha }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: teploy deploy --image ghcr.io/myorg/myapp:${{ github.sha }}Deploy notifications
Get notified on deploy success or failure. Add notification channels to teploy.yml:
notifications:
channels:
- type: slack
url: https://hooks.slack.com/services/T.../B.../xxx
- type: webhook
url: https://example.com/deploy-webhook