# CI/CD Pipeline for Ghaymah

## Overview

This GitHub Actions workflow automates the CI/CD process for the Ghaymah application. It builds a Docker image, pushes it to the Ghaymah Container Registry, and requires manual approval before deploying to the production environment.

---

## Workflow Steps

1. Trigger the workflow on every push to the `main` branch.
2. Checkout the source code.
3. Build the Docker image.
4. Login to the Ghaymah Container Registry using GitHub Secrets.
5. Push the Docker image to the registry.
6. Wait for manual approval before deploying to the production environment.
7. Deploy the application to production.

---

## Manual Approval

The deployment job uses the `production` GitHub Environment.

```yaml
environment:
  name: production
```

This pauses the workflow until an authorized reviewer approves the deployment.

---

## GitHub Secrets

The workflow expects the following secrets:

- GHAYMAH_REGISTRY
- GHAYMAH_USERNAME
- GHAYMAH_TOKEN

These secrets securely store the registry URL and authentication credentials without exposing sensitive information in the workflow file.

---

## Difference Between Staging and Production

| Staging | Production |
|---------|------------|
| Used for testing before release. | Used by real users. |
| Developers and QA teams validate new features. | End users access the application. |
| Bugs can be found and fixed safely. | Stability and availability are the highest priority. |
| New changes are tested first. | Only approved and tested changes are deployed. |

---

## Deployment Flow

```text
Developer Push
      ↓
Build Docker Image
      ↓
Push to Ghaymah Container Registry
      ↓
Deploy to Staging
      ↓
Testing & Validation
      ↓
Manual Approval
      ↓
Deploy to Production
```

This deployment strategy ensures that every production release is reviewed and approved before it reaches end users.