Complete Ghaymah Internship Assessment
هذا الالتزام موجود في:
97
cicd/workflow.yml
Normal file
97
cicd/workflow.yml
Normal file
@@ -0,0 +1,97 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Ghaymah Container Registry
|
||||
run: |
|
||||
echo "${{ secrets.GHAYMAH_TOKEN }}" | docker login registry.ghaymah.systems \
|
||||
--username ${{ secrets.GHAYMAH_USERNAME }} \
|
||||
--password-stdin
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t registry.ghaymah.systems/sample-api:${{ github.sha }} .
|
||||
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
docker push registry.ghaymah.systems/sample-api:${{ github.sha }}
|
||||
|
||||
deploy-staging:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Deploy to Staging
|
||||
run: |
|
||||
ghaymah deploy \
|
||||
--environment staging \
|
||||
--image registry.ghaymah.systems/sample-api:${{ github.sha }}
|
||||
|
||||
deploy-production:
|
||||
needs: deploy-staging
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
environment:
|
||||
name: production
|
||||
|
||||
steps:
|
||||
- name: Manual Approval
|
||||
run: echo "Waiting for manual approval..."
|
||||
|
||||
- name: Deploy to Production
|
||||
run: |
|
||||
ghaymah deploy \
|
||||
--environment production \
|
||||
--image registry.ghaymah.systems/sample-api:${{ github.sha }}
|
||||
|
||||
# environment:
|
||||
# name: production
|
||||
|
||||
################ Staging و Production
|
||||
|
||||
# Staging:
|
||||
# - Testing environment
|
||||
# - Used before production
|
||||
# - Safe for validation
|
||||
|
||||
# Production:
|
||||
# - Live environment
|
||||
# - Real users
|
||||
# - Requires manual approval
|
||||
# - High availability and monitoring
|
||||
|
||||
|
||||
########################### Ghaymah CLI
|
||||
|
||||
# Ghaymah CLI Documentation
|
||||
#
|
||||
# Install CLI
|
||||
# curl -fsSL https://ghaymah.systems/install.sh | bash
|
||||
#
|
||||
# Login
|
||||
# ghaymah login
|
||||
#
|
||||
# Verify
|
||||
# ghaymah whoami
|
||||
#
|
||||
# Deploy
|
||||
# ghaymah deploy --environment staging
|
||||
#
|
||||
# Deploy Production
|
||||
# ghaymah deploy --environment production
|
||||
المرجع في مشكلة جديدة
حظر مستخدم