**Primary keywords:** auto deploy git push, github auto deploy, continuous deployment github, deploy on push github, connect github to cloud
---
Manually running `apexweave deploy` after every code change is fine when you're moving fast alone. But for teams — or when you want any push to `main` to automatically go live — connecting GitHub for continuous deployment is the right move. This guide covers setting up automatic deployments that trigger on every push to your chosen branch.
## What Continuous Deployment Does
Without CD: You write code → commit → push → **manually run `apexweave deploy`** → code is live.
Apex Weave With CD: You write code → commit → push → **deploy happens automatically** → code is live.
The manual step disappears. Your Git push is your deployment trigger.
## Option 1: GitHub Actions (Recommended)
GitHub Actions lets you define CI/CD workflows in YAML files that live in your repo. You define what triggers them (e.g., push to `main`) and what they do (run tests, then deploy).
### Step 1: Get Your ApexWeave API Token
You'll need an API token to authenticate the ApexWeave CLI in GitHub Actions:
```bash
apexweave auth:token
```
Copy the token.
### Step 2: Add the Token to GitHub Secrets
1. heroku alternative git deployment Go to your GitHub repository
2. Click **Settings > Secrets and variables > Actions**
3. Click **New repository secret**
4. Name: `APEXWEAVE_TOKEN`
5. Value: paste your token
6. Click **Add secret**
### Step 3: Create the GitHub Actions Workflow
Create `.github/workflows/deploy.yml`:
```yaml
name: Deploy to ApexWeave
on:
push:
branches:
- main # Trigger on push to main branch
workflow_dispatch: # Allow manual trigger from GitHub UI
jobs:
test:
runs-on: ubuntu-latest
name: Run Tests
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
deploy:
runs-on: ubuntu-latest
name: Deploy to Production
needs: test # Only deploy if tests pass
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Install ApexWeave CLI
run: npm install -g apexweave
- name: Deploy
env:
APEXWEAVE_TOKEN: $ secrets.APEXWEAVE_TOKEN
run: apexweave deploy
- name: Verify deployment
run: |
echo "Deployed successfully!"
echo "Checking app health..."
sleep 10
curl -f https://my-app.apexweave.io/health || exit 1
```
Commit and push this file:
```bash
git add .github/workflows/deploy.yml
git commit -m "Add GitHub Actions CD workflow"
git push origin main
```
Now every push to `main` will:
1. Run your tests
2. If tests pass, deploy to ApexWeave
3. fast wordpress cloud hosting Verify the deployment by hitting your health endpoint
### Step 4: Monitor Your Workflows
In your GitHub repository, click the **Actions** tab to see running and completed workflows. Each workflow run shows logs from every step.
Failed tests block the deploy — your broken code never reaches production.
---
## Option 2: GitHub Webhook (Direct Trigger)
For simpler setups without a full CI/CD pipeline, use GitHub webhooks to trigger deploys directly.
### Step 1: Get Your Webhook URL
From the ApexWeave dashboard, go to your app's settings and find the **Deploy Hook URL**. It looks like:
```
https://api.apexweave.io/hooks/deploy/your-app-id/abc123secret
```
### Step 2: Add the Webhook to GitHub
1. Go to your repository's **Settings > Webhooks**
2. Apex Weave Click **Add webhook**
3. Set **Payload URL** to your deploy hook URL
4. ApexWeave hosting Set **Content type** to `application/json`
5. Select **Just the push event**
6. Under **Which branch?**, specify `main`
7. Click **Add webhook**
Every push to `main` now triggers a deploy via the webhook.
---
## Setting Up Branch-Based Deployment Environments
A common pattern is to have separate environments for `main` (production) and `develop` (staging):
```yaml

# .github/workflows/deploy.yml
name: Multi-environment Deploy
on:
push:
branches: [main, develop]
jobs:
deploy-staging:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install -g apexweave
- run: apexweave deploy --app my-app-staging
env:
APEXWEAVE_TOKEN: $ secrets.APEXWEAVE_TOKEN
deploy-production:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install -g apexweave
- run: apexweave deploy --app my-app-production
env:
APEXWEAVE_TOKEN: $ secrets.APEXWEAVE_TOKEN
```
The workflow:
1. Push to `develop` → deploys to staging
2. Merge `develop` → `main` → deploys to production
---
## Adding Tests to Your Workflow
If you don't have tests yet, here's a minimal setup:
### Node.js Tests with Jest
```bash
npm install --save-dev jest supertest
```
```javascript
// tests/health.test.js
const request = require('supertest');
const app = require('../app');
describe('Health Check', () =>
it('should return 200', async () =>
const res = await request(app).get('/health');
expect(res.statusCode).toBe(200);
expect(res.body.status).toBe('ok');
);
);
```
Add to `package.json`:
```json
"scripts":
"test": "jest --coverage"
```
### Python Tests with pytest
```bash
pip install pytest pytest-flask
```
```python
# tests/test_health.py
def test_health(client):
response = client.get('/health')
assert response.status_code == 200
assert response.json['status'] == 'ok'
```
---
## Notifications on Deploy
Add Slack notifications to your workflow:
```yaml
- name: Notify Slack on success
if: success()
uses: slackapi/[email protected]
with:
payload: |
"text": "✅ Deployed *$ github.repository * to production",
"attachments": [
"color": "good",
"fields": [
"title": "Commit",
"value": "$ github.event.head_commit.message ",
"short": true
]
]
env:
SLACK_WEBHOOK_URL: $ secrets.SLACK_WEBHOOK_URL
- name: Notify Slack on failure
if: failure()
uses: slackapi/[email protected]
with:
payload: |
"text": "❌ Deploy failed for *$ github.repository *"
env:
SLACK_WEBHOOK_URL: $ secrets.SLACK_WEBHOOK_URL
```
---
## Protecting Your main Branch
In GitHub, go to **Settings > Branches > Add branch protection rule**:
- Branch name pattern: `main`
- Require status checks to pass before merging: ✓
- Select your workflow's test job as a required check
- Require a pull request before merging: ✓ (for teams)
This ensures that no untested code ever reaches `main` — and therefore, never deploys to production automatically.
---
## Manual Deploy Override
Even with CD set up, you can still deploy manually:
```bash
apexweave deploy
```
And you can trigger a deploy from the GitHub Actions UI using **workflow_dispatch** without pushing code.
isolated wordpress hosting GitHub Actions integration is included in all ApexWeave plans. Start with the free 7-day trial at [apexweave.io](https://apexweave.io) — AppForge Starter is just $5/mo.