# CI/CD Documentation

## Note

The assignment requests pushing the Docker image to a **Ghaymah Container Registry**. However, no publicly available documentation or registry endpoint could be found for a Ghaymah Container Registry. Therefore, this project uses **GitHub Container Registry (GHCR)** as the image registry while keeping the deployment workflow compatible with the documented Ghaymah CLI deployment process.

## Staging vs Production

### Staging

The staging environment is a testing setup that closely mimics the production environment. It is used to validate new features, verify bug fixes, and test deployment workflows before releasing changes to end users. This helps detect issues without affecting the live application.

### Production

The production environment is the live environment used by real users. Deployments to production should be stable, thoroughly tested, and carefully controlled. In this project, production deployments require manual approval using GitHub Environments before the deployment job is executed.

## Manual Approval

The GitHub Actions workflow uses a protected `production` environment. Before the deployment job starts, GitHub pauses the workflow and waits for an authorized reviewer to approve the deployment. This provides an additional safety layer to prevent unintended production releases.

## Connecting with Ghaymah CLI

The available Ghaymah documentation describes deploying applications using the Ghaymah CLI. The general deployment workflow is:

1. Install the Ghaymah CLI:

```bash
curl -sSl https://cli.ghaymah.systems/install.sh | bash
```

2. Initialize the application:

```bash
gy resource app init -p <project_id>
```

3. Launch the application:

```bash
gy resource app launch
```

The application should contain a valid `Dockerfile`, allowing the Ghaymah CLI to package and deploy the application.