CI/CD7 min read
GitHub Actions Integration: CI/CD for OpenClaw Apps
Set up automated CI/CD for your OpenClaw app with GitHub Actions — tests, builds, and deploys on every push.
GitHub Actions makes it easy to automate your OpenClaw deployment pipeline. Every push runs tests, builds, and deploys — automatically.
The Goal
push to main → run tests → deploy to staging
push a tag → run tests → deploy to production
Step 1: Get Your OpenClaw API Key
openclaw api-key create --name github-actions
Copy the key — you'll add it to GitHub Secrets.
Step 2: Add Secrets to GitHub
- Go to your repo → Settings → Secrets and variables → Actions
- Add:
OPENCLAW_API_KEY— your API keyOPENCLAW_APP_NAME— your app name (optional, uses openclaw.json)
Step 3: Create the Workflow
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm test
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- name: Deploy to OpenClaw
env:
OPENCLAW_API_KEY: ${{ secrets.OPENCLAW_API_KEY }}
run: |
npm install -g @openclaw/cli
openclaw deploy --app ${{ vars.OPENCLAW_APP_NAME || 'my-app' }}
Step 4: Production Deploys on Tags
jobs:
deploy-prod:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- name: Deploy to Production
env:
OPENCLAW_API_KEY: ${{ secrets.OPENCLAW_API_KEY }}
run: |
npm install -g @openclaw/cli
openclaw deploy --app production-app --env production
What You Get
- Every PR — tests run, optional staging deploy
- Every merge to main — auto-deploy to staging
- Every tag — auto-deploy to production
- Rollback —
git revert+ push triggers a fresh deploy
Secrets Management
Never hardcode secrets. Use GitHub Secrets for:
OPENCLAW_API_KEYDATABASE_URL(if different per environment)TELEGRAM_BOT_TOKEN(if using Telegram alerts)
Custom Domains
If your OpenClaw app uses custom domains, configure the domain in openclaw.json:
{
"name": "my-app",
"domains": ["myapp.com", "www.myapp.com"]
}
OpenClaw handles SSL automatically on deploy.