name: Build and Push Docker Image

on:
  push:
    branches:
      - main

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 "Login to Ghaymah Registry"
          # ghaymah login

      - name: Build Docker Image
        run: |
          docker build -t ghaymah-api:latest .

      - name: Tag Docker Image
        run: |
          docker tag ghaymah-api:latest registry.ghaymah.systems/ghaymah-api:latest

      - name: Push Docker Image
        run: |
          docker push registry.ghaymah.systems/ghaymah-api:latest

  deploy-production:
    needs: build

    runs-on: ubuntu-latest

    environment:
      name: production

    steps:
      - name: Deploy to Production
        run: |
          echo "Deploying application..."
