refactor: reorganize directory structure to match exam submission spec

هذا الالتزام موجود في:
mac
2026-07-27 14:14:17 +03:00
الأصل 5419a51265
التزام 23a5119c9d
25 ملفات معدلة مع 34 إضافات و193 حذوفات

60
q3-cicd/workflow.yml Normal file
عرض الملف

@@ -0,0 +1,60 @@
name: Build and Deploy to ghaymah.systems
on:
push:
branches:
- main
env:
REGISTRY: registry.ghaymah.systems
IMAGE_NAME: ${{ github.repository }}/myapp-api
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to ghaymah Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.GHAYMAH_USERNAME }}
password: ${{ secrets.GHAYMAH_TOKEN }}
- name: Build and push Docker image (Staging Tag)
uses: docker/build-push-action@v5
with:
context: ./api
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-${{ github.sha }}
deploy-staging:
needs: build-and-push
runs-on: ubuntu-latest
environment: staging
steps:
- name: Deploy to Staging
run: |
echo "Deploying staging-${{ github.sha }} to ghaymah systems..."
# Example CLI command: ghaymah deploy --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-${{ github.sha }} --env staging
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
environment:
name: production
# Manual approval is configured at the GitHub Environment level in repo settings.
steps:
- name: Retag image for production
uses: docker/build-push-action@v5
with:
context: ./api
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:production-${{ github.sha }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Deploy to Production
run: |
echo "Deploying production-${{ github.sha }} to ghaymah systems..."
# Example CLI command: ghaymah deploy --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:production-${{ github.sha }} --env production