diff --git a/q3-cicd/README.md b/q3-cicd/README.md new file mode 100644 index 0000000..069b4b2 --- /dev/null +++ b/q3-cicd/README.md @@ -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. diff --git a/q3-cicd/workflow.yml b/q3-cicd/workflow.yml new file mode 100644 index 0000000..7895620 --- /dev/null +++ b/q3-cicd/workflow.yml @@ -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..."