Deployment Keys

Deployment keys provide a secure way to authenticate CI/CD pipelines and automated workflows with Tilda. These keys are scoped to specific projects or sites, following the principle of least privilege.

Creating Deployment Keys

You can create deployment keys using the Tilda CLI. The key will be scoped to the specified project:

Create a project-scoped deployment key
Bash
tilda deployment-key create --project myproject

To create a key scoped to a specific site within a project:

Create a site-scoped deployment key
Bash
tilda deployment-key create --project myproject --site your-site

After creating a key, you'll receive a JSON response containing the key details. Make sure to save this information securely, as the private key will only be shown once.

Managing Keys

You can view and manage your deployment keys in the project settings page. Navigate to your project, click on "Settings", and scroll to the "Deployment Keys" section. Here you can:

Warning: Revoking a key is permanent and cannot be undone. Any CI/CD pipelines or automated workflows using the key will stop working immediately.

Using Keys in CI/CD

To use a deployment key in your CI/CD pipeline, set it as an environment variable:

CI/CD Environment Variables
YAML
# GitHub Actions
env:
  TILDA_CLI_INLINE_IDENTITY_JSON: ${{ secrets.TILDA_DEPLOYMENT_KEY }}

# GitLab CI
variables:
  TILDA_CLI_INLINE_IDENTITY_JSON: $TILDA_DEPLOYMENT_KEY

# CircleCI
environment:
  TILDA_CLI_INLINE_IDENTITY_JSON: ${TILDA_DEPLOYMENT_KEY}

Security Best Practices

Example Workflows

GitHub Actions

GitHub Actions Workflow
YAML
name: Deploy to Tilda
on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20.x'
      - name: Install dependencies
        run: npm ci
      - name: Install Tilda CLI
        run: npm install -g @tildacloud/cli
      - run: tilda build nextjs
      - name: Deploy
        env:
          TILDA_CLI_INLINE_IDENTITY_JSON: ${{ secrets.TILDA_DEPLOYMENT_KEY }}
        run: tilda deploy --project myproject --site mysite

GitLab CI

GitLab CI Pipeline
YAML
deploy:
  stage: deploy
  image: node:latest
  script:
    - npm install -g @tildacloud/cli
    - tilda build nextjs
    - tilda deploy --project myproject --site mysite
  only:
    - main

Troubleshooting

Invalid or Expired Key

If you receive an "Invalid credentials" error, make sure:

Permission Errors

If you get a permission error, verify that: