Set Up CI/CD

Temps deploys automatically on every push. For teams that want tests, linting, or approval gates before deployment, you can add CI/CD workflows that run quality checks first and then trigger Temps deployments.


How deployment triggers work

Temps receives Git webhooks from your provider (GitHub, GitLab, Bitbucket, Gitea). When you push to a branch that matches an environment, Temps starts a deployment automatically.

The default flow:

Push to main → GitHub sends webhook → Temps builds and deploys

This means CI/CD is already built in for the simple case. You only need external CI when you want to add checks before deployment (tests, linting, type checking) or want programmatic control over when deployments happen.


Option 1: Auto-deploy with CI checks

Keep Temps auto-deploy enabled and run CI checks in parallel. Your CI pipeline runs tests while Temps builds and deploys. If tests fail, you know there is a problem — but the deployment still happens.

This is the simplest approach for solo developers or small teams who want fast feedback:

name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm test

Temps deploys independently — the CI pipeline provides feedback but does not gate the deployment.


Option 2: CI gates before deploy

Disable auto-deploy on the environment and trigger deployments from CI only after checks pass:

Step 1: Disable auto-deploy

Go to your project > Environments > select the environment > Settings and set Automatic Deploy to off.

Step 2: Trigger deployment from CI

Use the Temps API or CLI to trigger a deployment after your CI checks pass:

name: Test and Deploy
on:
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm test

  deploy:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - name: Trigger Temps deployment
        run: |
          curl -X POST "$TEMPS_API_URL/projects/$PROJECT_ID/trigger-pipeline" \
            -H "Authorization: Bearer $TEMPS_API_TOKEN" \
            -H "Content-Type: application/json" \
            -d "{\"environment_id\": $ENVIRONMENT_ID, \"branch\": \"main\"}"
        env:
          TEMPS_API_URL: ${{ secrets.TEMPS_API_URL }}
          TEMPS_API_TOKEN: ${{ secrets.TEMPS_API_TOKEN }}
          PROJECT_ID: ${{ secrets.TEMPS_PROJECT_ID }}
          ENVIRONMENT_ID: ${{ secrets.TEMPS_ENVIRONMENT_ID }}

Step 3: Store secrets in CI

Add these secrets to your CI provider:

SecretValueWhere to find it
TEMPS_API_URLYour Temps instance URL (e.g. https://temps.example.com)Your server configuration
TEMPS_API_TOKENAPI token from the Temps dashboardSettings > API Tokens
TEMPS_PROJECT_IDNumeric project IDProject URL or API
TEMPS_ENVIRONMENT_IDNumeric environment IDEnvironment settings

Using the Temps CLI

The Temps CLI provides more control than raw API calls. Install it in your CI environment:

# Install
npx @temps-sdk/cli --help

# Or with bun
bunx @temps-sdk/cli --help

Deploy from Git

Trigger a deployment for a specific branch, tag, or commit:

# Deploy the current branch
temps deploy git --project my-app --environment production

# Deploy a specific commit
temps deploy git --project my-app --environment production --commit abc123

# Deploy a tag
temps deploy git --project my-app --environment production --tag v1.2.3

# Wait for deployment to complete (with timeout)
temps deploy git --project my-app --environment production --wait --timeout 300

Deploy a pre-built image

If your CI builds a Docker image, deploy it directly without rebuilding on Temps:

temps deploy image \
  --image ghcr.io/your-org/your-app:latest \
  --project my-app \
  --environment production \
  --wait

Deploy static files

Upload static files from your CI build output:

temps deploy static \
  --path ./dist \
  --project my-app \
  --environment production

Authentication

Set these environment variables for the CLI:

export TEMPS_API_URL=https://temps.example.com
export TEMPS_API_TOKEN=your-api-token

Outbound webhooks

Temps can send deployment event notifications to external systems. Use this to post to Slack, update a status page, or trigger downstream actions.

Setting up

  1. Go to Settings > Webhooks in your project
  2. Add a webhook URL (e.g. a Slack incoming webhook URL)
  3. Select events to listen for
  4. Optionally set a secret for HMAC signature verification

Available events

EventDescription
deployment.createdA deployment was queued
deployment.succeededThe deployment completed successfully
deployment.failedThe deployment failed
deployment.cancelledThe deployment was cancelled
deployment.readyThe deployment is live and receiving traffic
project.createdA new project was created
project.deletedA project was deleted
domain.createdA domain was added
domain.provisionedA TLS certificate was provisioned

Webhook payload

Each webhook delivery includes:

  • Project name and ID
  • Branch and commit SHA
  • Commit message
  • Deployment status
  • Timestamp

Failed deliveries can be retried from the webhook delivery history in the dashboard.


Rollback

If a deployment introduces a bug, you can roll back:

Automatic rollback

Temps rolls back automatically if the new container fails health checks. The old container keeps running and the route table reverts — no manual intervention needed.

Manual rollback via dashboard

  1. Go to your project > Deployments
  2. Find the last working deployment
  3. Click Rollback to redeploy that version

Git-based rollback

Revert the commit and push:

git revert HEAD
git push origin main

Temps deploys the reverted commit as a new deployment.


Complete example: Next.js with GitHub Actions

.github/workflows/deploy.yml

name: Test and Deploy

on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - run: npm ci
      - run: npm run lint
      - run: npx tsc --noEmit
      - run: npm test -- --ci

  deploy:
    needs: test
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to Temps
        run: |
          curl -X POST "$TEMPS_API_URL/projects/$PROJECT_ID/trigger-pipeline" \
            -H "Authorization: Bearer $TEMPS_API_TOKEN" \
            -H "Content-Type: application/json" \
            -d "{\"environment_id\": $ENVIRONMENT_ID, \"branch\": \"main\", \"commit\": \"${{ github.sha }}\"}"
        env:
          TEMPS_API_URL: ${{ secrets.TEMPS_API_URL }}
          TEMPS_API_TOKEN: ${{ secrets.TEMPS_API_TOKEN }}
          PROJECT_ID: ${{ secrets.TEMPS_PROJECT_ID }}
          ENVIRONMENT_ID: ${{ secrets.TEMPS_ENVIRONMENT_ID }}

What to explore next

Preview deployments Environment variables Scale your application Add monitoring

Was this page helpful?