SwiftClaw

Deployment

Deployment OverviewProduction DeploymentCI/CD IntegrationRollback Strategies

Scaling

Scaling OverviewPerformance OptimizationCost OptimizationLoad Balancing

Security

Security OverviewAuthenticationSecrets ManagementSecurity Best Practices

Troubleshooting

TroubleshootingCommon IssuesDebuggingPerformance IssuesSupport
SwiftClaw

CI/CD Integration

Automate agent deployments with CI/CD pipelines

CI/CD Integration

Automate your SwiftClaw agent deployments with continuous integration and delivery.

GitHub Actions

Basic Workflow

name: Deploy Agent
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
      
      - name: Install SwiftClaw CLI
        run: npm install -g @swiftclaw/cli
      
      - name: Deploy Agent
        env:
          SWIFTCLAW_TOKEN: ${{ secrets.SWIFTCLAW_TOKEN }}
        run: |
          swiftclaw login --token $SWIFTCLAW_TOKEN
          swiftclaw deploy my-agent --env production

Advanced Workflow with Testing

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

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Tests
        run: npm test
  
  deploy:
    needs: test
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Deploy to Production
        env:
          SWIFTCLAW_TOKEN: ${{ secrets.SWIFTCLAW_TOKEN }}
        run: |
          swiftclaw login --token $SWIFTCLAW_TOKEN
          swiftclaw deploy my-agent --env production --wait

GitLab CI

# .gitlab-ci.yml
stages:
  - test
  - deploy

test:
  stage: test
  script:
    - npm install
    - npm test

deploy:
  stage: deploy
  only:
    - main
  script:
    - npm install -g @swiftclaw/cli
    - swiftclaw login --token $SWIFTCLAW_TOKEN
    - swiftclaw deploy my-agent --env production
  environment:
    name: production

CircleCI

# .circleci/config.yml
version: 2.1

jobs:
  test:
    docker:
      - image: cimg/node:18.0
    steps:
      - checkout
      - run: npm install
      - run: npm test
  
  deploy:
    docker:
      - image: cimg/node:18.0
    steps:
      - checkout
      - run: npm install -g @swiftclaw/cli
      - run: |
          swiftclaw login --token $SWIFTCLAW_TOKEN
          swiftclaw deploy my-agent --env production

workflows:
  test-and-deploy:
    jobs:
      - test
      - deploy:
          requires:
            - test
          filters:
            branches:
              only: main

Environment-Specific Deployments

Deploy to different environments based on branch:

name: Multi-Environment Deploy
on:
  push:
    branches: [main, staging, develop]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Determine Environment
        id: env
        run: |
          if [ "${{ github.ref }}" == "refs/heads/main" ]; then
            echo "environment=production" >> $GITHUB_OUTPUT
          elif [ "${{ github.ref }}" == "refs/heads/staging" ]; then
            echo "environment=staging" >> $GITHUB_OUTPUT
          else
            echo "environment=development" >> $GITHUB_OUTPUT
          fi
      
      - name: Deploy
        env:
          SWIFTCLAW_TOKEN: ${{ secrets.SWIFTCLAW_TOKEN }}
        run: |
          swiftclaw login --token $SWIFTCLAW_TOKEN
          swiftclaw deploy my-agent --env ${{ steps.env.outputs.environment }}

Deployment Strategies

Blue-Green Deployment

# Deploy new version (green)
swiftclaw deploy my-agent --env production --slot green

# Test green deployment
swiftclaw test my-agent --slot green

# Switch traffic to green
swiftclaw swap my-agent --from blue --to green

Canary Deployment

# Deploy canary with 10% traffic
swiftclaw deploy my-agent --env production --canary 10

# Monitor metrics
swiftclaw metrics my-agent --canary

# Promote canary to 100%
swiftclaw promote my-agent --canary

Secrets Management

Never commit secrets: Use your CI/CD platform's secret management.

GitHub Secrets

  1. Go to repository Settings → Secrets
  2. Add SWIFTCLAW_TOKEN
  3. Reference in workflow: ${{ secrets.SWIFTCLAW_TOKEN }}

Environment Variables

env:
  SWIFTCLAW_TOKEN: ${{ secrets.SWIFTCLAW_TOKEN }}
  OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  DATABASE_URL: ${{ secrets.DATABASE_URL }}

Deployment Notifications

Slack Notifications

- name: Notify Slack
  if: always()
  uses: 8398a7/action-slack@v3
  with:
    status: ${{ job.status }}
    text: 'Agent deployment ${{ job.status }}'
    webhook_url: ${{ secrets.SLACK_WEBHOOK }}

Discord Notifications

- name: Notify Discord
  if: always()
  run: |
    curl -X POST ${{ secrets.DISCORD_WEBHOOK }} \
      -H "Content-Type: application/json" \
      -d '{"content": "Agent deployment ${{ job.status }}"}'

Next Steps

  • Rollback Strategies
  • Production Deployment
  • Monitoring

How is this guide ?

Last updated on

Production Deployment

Deploy SwiftClaw agents to production environments

Rollback Strategies

Safely rollback agent deployments when issues occur

On this page

CI/CD Integration
GitHub Actions
Basic Workflow
Advanced Workflow with Testing
GitLab CI
CircleCI
Environment-Specific Deployments
Deployment Strategies
Blue-Green Deployment
Canary Deployment
Secrets Management
GitHub Secrets
Environment Variables
Deployment Notifications
Slack Notifications
Discord Notifications
Next Steps