Skip to main content
The atmn CLI is designed for seamless CI/CD integration with headless mode, proper exit codes, and environment variable support for automated deployments.

Headless Mode

The CLI automatically detects non-TTY environments (CI/CD) and switches to headless mode, providing:
  • Plain text output suitable for logs
  • Structured data in JSON/CSV formats
  • Proper exit codes for success/failure detection
  • No interactive prompts that would hang builds
  • Batch operations optimized for automation

Automatic Detection

atmn push
# Shows beautiful interactive UI with colors and prompts

Force Headless Mode

Override TTY detection with the --headless flag:
atmn push --headless  # Force headless mode even in terminal

Environment Setup

API Key Configuration

Set environment variables in your CI/CD platform:
AUTUMN_SECRET_KEY
string
Sandbox API key (format: am_sk_test_*)
AUTUMN_PROD_SECRET_KEY
string
Production API key (format: am_sk_live_*)
env:
  AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_SECRET_KEY }}
  AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}

GitHub Actions Integration

Basic Workflow

name: Deploy Autumn Configuration

on:
  push:
    branches: [main]
    paths: ['autumn.config.ts']

jobs:
  deploy-sandbox:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install atmn CLI
        run: npm install -g atmn
        
      - name: Deploy to Sandbox
        run: atmn push --yes
        env:
          AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_SECRET_KEY }}

  deploy-production:
    runs-on: ubuntu-latest
    needs: deploy-sandbox
    if: github.ref == 'refs/heads/main'
    environment: production
    
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install atmn CLI
        run: npm install -g atmn
        
      - name: Deploy to Production
        run: atmn push --prod --yes
        env:
          AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}

Advanced Workflow with Validation

name: Autumn Configuration Pipeline

on:
  pull_request:
    paths: ['autumn.config.ts']
  push:
    branches: [main]
    paths: ['autumn.config.ts']

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install dependencies
        run: |
          npm install -g atmn
          npm install typescript
          
      - name: Validate Configuration
        run: |
          # Check TypeScript compilation
          npx tsc --noEmit autumn.config.ts
          
          # Validate with Autumn (dry-run)
          atmn preview
        env:
          AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_SECRET_KEY }}

  deploy-sandbox:
    runs-on: ubuntu-latest
    needs: validate
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install atmn CLI
        run: npm install -g atmn
        
      - name: Deploy to Sandbox
        run: atmn push --yes
        env:
          AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_SECRET_KEY }}
          
      - name: Generate SDK Types
        run: atmn pull
        env:
          AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_SECRET_KEY }}
          
      - name: Commit Updated Types
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: 'Update SDK types'
          file_pattern: '@useautumn-sdk.d.ts'

  deploy-production:
    runs-on: ubuntu-latest
    needs: deploy-sandbox
    if: github.ref == 'refs/heads/main'
    environment: production
    
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install atmn CLI
        run: npm install -g atmn
        
      - name: Deploy to Production
        run: atmn push --prod --yes
        env:
          AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}
          
      - name: Notify Deployment
        run: |
          echo "🚀 Autumn configuration deployed to production"
          atmn env --prod
        env:
          AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}

GitLab CI Integration

stages:
  - validate
  - deploy-sandbox
  - deploy-production

variables:
  NODE_VERSION: "18"

before_script:
  - apt-get update -qq && apt-get install -y nodejs npm
  - npm install -g atmn

validate-config:
  stage: validate
  script:
    - atmn preview
  only:
    changes:
      - autumn.config.ts

deploy-sandbox:
  stage: deploy-sandbox
  script:
    - atmn push --yes
    - atmn pull  # Generate updated types
  artifacts:
    paths:
      - "@useautumn-sdk.d.ts"
    expire_in: 1 hour
  only:
    - main
  environment:
    name: sandbox

deploy-production:
  stage: deploy-production
  script:
    - atmn push --prod --yes
  when: manual
  only:
    - main
  environment:
    name: production

Exit Codes & Error Handling

The CLI provides proper exit codes for CI/CD error detection:
0
exit-code
Success - Operation completed successfully
1
exit-code
General Error - Command failed (network, auth, validation, etc.)
2
exit-code
Configuration Error - Invalid autumn.config.ts or missing file

Error Handling Examples

#!/bin/bash
set -e  # Exit on any error

# Deploy to sandbox
if atmn push --yes; then
    echo "✅ Sandbox deployment successful"
else
    echo "❌ Sandbox deployment failed"
    exit 1
fi

# Deploy to production only if sandbox succeeded
if atmn push --prod --yes; then
    echo "✅ Production deployment successful"
    # Send success notification
    curl -X POST "$SLACK_WEBHOOK" -d '{"text":"🚀 Autumn config deployed to production"}'
else
    echo "❌ Production deployment failed"
    # Send failure notification
    curl -X POST "$SLACK_WEBHOOK" -d '{"text":"❌ Autumn production deployment failed"}'
    exit 1
fi

Automated Workflows

Scheduled Sync

Keep your types up-to-date with scheduled pulls:
name: Sync SDK Types

on:
  schedule:
    - cron: '0 2 * * *'  # Daily at 2 AM
  workflow_dispatch:      # Manual trigger

jobs:
  sync-types:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install atmn CLI
        run: npm install -g atmn
        
      - name: Sync from Production
        run: atmn pull --prod
        env:
          AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}
          
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v5
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: 'chore: sync SDK types from production'
          title: 'Sync SDK Types'
          body: 'Automated sync of SDK types from Autumn production'
          branch: 'chore/sync-sdk-types'

Multi-Environment Deployments

Deploy different configurations to different environments:
name: Multi-Environment Deploy

on:
  push:
    branches: [develop, staging, main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install atmn CLI
        run: npm install -g atmn
        
      - name: Deploy to Development
        if: github.ref == 'refs/heads/develop'
        run: atmn push --yes
        env:
          AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_DEV_SECRET_KEY }}
          
      - name: Deploy to Staging
        if: github.ref == 'refs/heads/staging' 
        run: atmn push --yes
        env:
          AUTUMN_SECRET_KEY: ${{ secrets.AUTUMN_STAGING_SECRET_KEY }}
          
      - name: Deploy to Production
        if: github.ref == 'refs/heads/main'
        run: atmn push --prod --yes
        env:
          AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}

Docker Integration

Dockerfile

FROM node:18-alpine

# Install atmn CLI
RUN npm install -g atmn

# Copy configuration
COPY autumn.config.ts .

# Set up entrypoint
COPY deploy.sh .
RUN chmod +x deploy.sh

ENTRYPOINT ["./deploy.sh"]

Docker Compose

version: '3.8'

services:
  autumn-deploy:
    build: .
    environment:
      - ENVIRONMENT=${ENVIRONMENT:-sandbox}
      - AUTUMN_SECRET_KEY=${AUTUMN_SECRET_KEY}
      - AUTUMN_PROD_SECRET_KEY=${AUTUMN_PROD_SECRET_KEY}
    volumes:
      - .:/app
    working_dir: /app

Monitoring & Notifications

Slack Notifications

#!/bin/bash

SLACK_WEBHOOK="https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"

# Deploy configuration
if atmn push --prod --yes; then
    # Success notification
    curl -X POST "$SLACK_WEBHOOK" \
         -H 'Content-type: application/json' \
         -d '{
           "text": "✅ Autumn configuration deployed to production",
           "attachments": [{
             "color": "good",
             "fields": [{
               "title": "Environment",
               "value": "Production",
               "short": true
             }, {
               "title": "Branch", 
               "value": "'$GITHUB_REF_NAME'",
               "short": true
             }]
           }]
         }'
else
    # Failure notification
    curl -X POST "$SLACK_WEBHOOK" \
         -H 'Content-type: application/json' \
         -d '{
           "text": "❌ Autumn configuration deployment failed",
           "attachments": [{
             "color": "danger",
             "fields": [{
               "title": "Environment",
               "value": "Production",
               "short": true
             }, {
               "title": "Branch",
               "value": "'$GITHUB_REF_NAME'",
               "short": true
             }]
           }]
         }'
    exit 1
fi

Security Best Practices

Secret Management

Never commit API keys to version control. Always use your CI/CD platform’s secret management system.
# ✅ Good - Use secrets
env:
  AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}

# ❌ Bad - Hardcoded key  
env:
  AUTUMN_PROD_SECRET_KEY: "am_sk_live_1234567890abcdef"

Environment Isolation

  • Development: Use separate Autumn organization/sandbox
  • Staging: Use production organization but sandbox environment
  • Production: Use production organization and production environment

Access Controls

Limit who can trigger production deployments:
deploy-production:
  runs-on: ubuntu-latest
  needs: deploy-sandbox
  environment: production  # Requires approval
  
  steps:
    - name: Deploy to Production
      run: atmn push --prod --yes
The CLI’s headless mode and proper exit codes make it ideal for automated deployments while maintaining the safety and validation features you need for production systems.