ci: complete CI/CD workflow documentation

هذا الالتزام موجود في:
2026-07-29 04:58:54 +03:00
الأصل 5e4d18fd77
التزام b63080442e
2 ملفات معدلة مع 94 إضافات و0 حذوفات

43
q3-cicd/README.md Normal file
عرض الملف

@@ -0,0 +1,43 @@
# 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.

51
q3-cicd/ghaymah-ci.yml Normal file
عرض الملف

@@ -0,0 +1,51 @@
name: ghaymah_exam CI/CD
on:
push:
branches:
- main
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./q1-deploy-monitor
file: ./q1-deploy-monitor/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/ghaymah-exam-ahmednasser-sre:latest
ghcr.io/${{ github.repository_owner }}/ghaymah-exam-ahmednasser-sre:${{ github.sha }}
deploy-production:
name: Deploy to Production
needs: build-and-push
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Deploy application
run: |
echo "Deploying image to production..."