Implement CI/CD pipeline for Ghaymah

هذا الالتزام موجود في:
momenlotfy
2026-07-28 22:12:40 +03:00
الأصل e718cecf90
التزام 1db0419b19
2 ملفات معدلة مع 31 إضافات و110 حذوفات

عرض الملف

@@ -8,188 +8,109 @@ on:
workflow_dispatch:
env:
APP_DIR: ./task1-deploy
jobs:
# ==================================
# Build & Validate
# ==================================
build:
name: Build Docker Image
name: Build & Validate Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker Image
- name: Build Docker image
run: |
docker build \
-t training-api:${{ github.sha }} \
${{ env.APP_DIR }}
-t training-api:${{ github.sha }} \
${{ env.APP_DIR }}
- name: Test Docker Image
- name: Run container
run: |
docker run -d \
--name test-container \
-p 8080:8080 \
training-api:${{ github.sha }}
--name test-container \
-p 8080:8080 \
training-api:${{ github.sha }}
- name: Health Check
run: |
sleep 5
curl -f http://localhost:8080/health
docker stop test-container
# ==================================
# Deploy Staging
# ==================================
- name: Cleanup
if: always()
run: |
docker stop test-container || true
docker rm test-container || true
deploy-staging:
name: Deploy to Staging
needs: build
runs-on: ubuntu-latest
environment:
name: staging
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install Ghaymah CLI
run: |
curl -sSl https://cli.ghaymah.systems/install.sh | bash
echo "$HOME/ghaymah/bin" >> $GITHUB_PATH
- name: Authenticate with Ghaymah
# حسب الوثائق الرسمية
- name: Authenticate
run: |
gy auth login \
--token "${{ secrets.GHAYMAH_API_TOKEN }}"
- name: Deploy Staging Application
echo "Login using: gy auth login"
- name: Launch Application
working-directory: task1-deploy
run: |
gy resource app launch
- name: Smoke Test Staging
- name: Smoke Test
run: |
sleep 20
curl -f \
https://task1-deploy-b18316770d08.hosted.ghaymah.systems/health
# ==================================
# Manual Approval
# ==================================
curl -f https://task1-deploy-aee3d4210e10.hosted.ghaymah.systems/health
approve-production:
name: Production Approval
name: Manual Approval
needs: deploy-staging
runs-on: ubuntu-latest
environment:
name: production-approval
steps:
- name: Waiting for approval
run: |
echo "Production deployment approved"
# ==================================
# Production Deployment
# ==================================
- run: echo "Waiting for manual approval"
deploy-production:
name: Deploy Production
needs:
- approve-production
needs: approve-production
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install Ghaymah CLI
run: |
curl -sSl https://cli.ghaymah.systems/install.sh | bash
echo "$HOME/ghaymah/bin" >> $GITHUB_PATH
- name: Authenticate with Ghaymah
- name: Authenticate
run: |
gy auth login \
--token "${{ secrets.GHAYMAH_API_TOKEN }}"
- name: Deploy Production Application
echo "Login using: gy auth login"
- name: Launch Application
working-directory: task1-deploy
run: |
gy resource app launch
- name: Production Health Check
run: |
sleep 20
curl -f \
https://task1-deploy-b18316770d08.hosted.ghaymah.systems/health
curl -f https://task1-deploy-aee3d4210e10.hosted.ghaymah.systems/health

عرض الملف

@@ -1,5 +1,5 @@
{
"id": "5ba192b0-d1f0-43a6-963d-be133af424b1",
"id": "9d8715ca-42b4-41f1-9852-767c3ffba36f",
"name": "task1-deploy",
"projectId": "34340b16-24f2-4db9-89e4-bf94bb372e68",
"ports": [