86 lines
2.1 KiB
Markdown
86 lines
2.1 KiB
Markdown
# 🚀 Auto-Deployment Status
|
|
|
|
## Current Setup
|
|
|
|
### GitHub Actions Workflow (`.github/workflows/ci-cd.yml`)
|
|
|
|
**Triggers on**: Push to `main` OR `production` branches
|
|
|
|
**What happens on `main` branch**:
|
|
- ✅ Runs tests
|
|
- ✅ Runs linting
|
|
- ✅ Builds Docker image
|
|
- ✅ Pushes image to registry
|
|
- ❌ **Does NOT deploy to server**
|
|
|
|
**What happens on `production` branch**:
|
|
- ✅ Runs tests
|
|
- ✅ Runs linting
|
|
- ✅ Builds Docker image
|
|
- ✅ Pushes image to registry
|
|
- ✅ **Deploys to server automatically**
|
|
|
|
### Key Line in Workflow
|
|
|
|
```yaml
|
|
# Line 159 in .github/workflows/ci-cd.yml
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/production'
|
|
```
|
|
|
|
This means deployment **only** happens on `production` branch.
|
|
|
|
## Answer: Can you merge to main and auto-deploy?
|
|
|
|
**❌ NO** - Merging to `main` will:
|
|
- Build and test everything
|
|
- Create Docker image
|
|
- **But NOT deploy to your server**
|
|
|
|
**✅ YES** - Merging to `production` will:
|
|
- Build and test everything
|
|
- Create Docker image
|
|
- **AND deploy to your server automatically**
|
|
|
|
## Options
|
|
|
|
### Option 1: Use Production Branch (Current Setup)
|
|
```bash
|
|
# Merge dev → main (tests/build only)
|
|
git checkout main
|
|
git merge dev
|
|
git push origin main
|
|
|
|
# Then merge main → production (auto-deploys)
|
|
git checkout production
|
|
git merge main
|
|
git push origin production # ← This triggers deployment
|
|
```
|
|
|
|
### Option 2: Enable Auto-Deploy on Main
|
|
If you want `main` to auto-deploy, I can update the workflow to deploy on `main` as well.
|
|
|
|
### Option 3: Manual Deployment
|
|
After merging to `main`, manually run:
|
|
```bash
|
|
./scripts/gitea-deploy.sh
|
|
# or
|
|
./scripts/auto-deploy.sh
|
|
```
|
|
|
|
## Recommendation
|
|
|
|
**Keep current setup** (deploy only on `production`):
|
|
- ✅ Safer: `main` is for testing builds
|
|
- ✅ `production` is explicitly for deployments
|
|
- ✅ Can test on `main` without deploying
|
|
- ✅ Clear separation of concerns
|
|
|
|
**Workflow**:
|
|
1. Merge `dev` → `main` (validates build works)
|
|
2. Test the built image if needed
|
|
3. Merge `main` → `production` (auto-deploys)
|
|
|
|
---
|
|
|
|
**Current Status**: Auto-deployment is configured, but only for `production` branch.
|