Q3
هذا الالتزام موجود في:
60
q3-cicd/README.md
Normal file
60
q3-cicd/README.md
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# CI/CD Documentation
|
||||||
|
|
||||||
|
## 1. Staging Environment
|
||||||
|
|
||||||
|
- Used for testing new releases.
|
||||||
|
- Verifies integration before production.
|
||||||
|
- Safe environment for developers.
|
||||||
|
- May contain test data.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Production Environment
|
||||||
|
|
||||||
|
- Live environment serving end users.
|
||||||
|
- Requires manual approval before deployment.
|
||||||
|
- High availability and monitoring.
|
||||||
|
- Uses real production data.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Difference Between Staging and Production
|
||||||
|
|
||||||
|
| Staging | Production |
|
||||||
|
|----------|------------|
|
||||||
|
| Testing | Live |
|
||||||
|
| Test Data | Real Data |
|
||||||
|
| Developers | End Users |
|
||||||
|
| Frequent Changes | Stable Releases |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ghaymah CLI Integration
|
||||||
|
|
||||||
|
### Login
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ghaymah login
|
||||||
|
```
|
||||||
|
|
||||||
|
### Initialize Project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ghaymah init
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ghaymah deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
### Check Status
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ghaymah status
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual Approval
|
||||||
|
|
||||||
|
Production deployments require approval using GitHub Environment Protection Rules before executing the deployment job.
|
||||||
50
q3-cicd/workflow.yml
Normal file
50
q3-cicd/workflow.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Ghaymah CI/CD
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build Docker Image
|
||||||
|
run: |
|
||||||
|
docker build -f q1-deploy-monitor/Dockerfile -t ghaymah-sre-api:${{ github.sha }} .
|
||||||
|
|
||||||
|
- name: Login to Ghaymah Registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.GHAYMAH_TOKEN }}" | docker login registry.ghaymah.systems \
|
||||||
|
-u "${{ secrets.GHAYMAH_USERNAME }}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
|
- name: Push Docker Image
|
||||||
|
run: |
|
||||||
|
docker tag ghaymah-sre-api:${{ github.sha }} registry.ghaymah.systems/${{ secrets.GHAYMAH_USERNAME }}/ghaymah-sre-api:${{ github.sha }}
|
||||||
|
docker push registry.ghaymah.systems/${{ secrets.GHAYMAH_USERNAME }}/ghaymah-sre-api:${{ github.sha }}
|
||||||
|
|
||||||
|
deploy-staging:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: staging
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to Staging
|
||||||
|
run: |
|
||||||
|
echo "Deploying to staging..."
|
||||||
|
|
||||||
|
deploy-production:
|
||||||
|
needs: deploy-staging
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: production
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to Production
|
||||||
|
run: |
|
||||||
|
echo "Deploying to production..."
|
||||||
المرجع في مشكلة جديدة
حظر مستخدم