diff --git a/q3-cicd/README.md b/q3-cicd/README.md new file mode 100644 index 0000000..5d51141 --- /dev/null +++ b/q3-cicd/README.md @@ -0,0 +1,43 @@ +# CI/CD Documentation + +## Staging vs Production + +### Staging Environment + +- Used for testing new releases before production. +- Contains test data. +- Developers and testers verify application functionality. +- Failures do not affect real users. + +### Production Environment + +- Used by real users. +- Contains live data. +- High availability and stability are required. +- Every deployment should be approved before release. + +--- + +## Ghaymah CLI Integration + +Example deployment workflow: + +1. Install the Ghaymah CLI. +2. Authenticate using your account credentials. +3. Login to the Ghaymah Container Registry. +4. Push the Docker image. +5. Deploy the latest image to the production environment. + +Example commands: + +```bash +ghaymah login + +ghaymah registry login + +docker push ghaymah.systems/my-api:latest + +ghaymah deploy +``` + +> Note: The exact commands may vary depending on the installed version of the Ghaymah CLI. diff --git a/q3-cicd/workflow.yml b/q3-cicd/workflow.yml index e69de29..0b266f7 100644 --- a/q3-cicd/workflow.yml +++ b/q3-cicd/workflow.yml @@ -0,0 +1,48 @@ +name: Build and Deploy + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Log in to Ghaymah Container Registry + run: | + echo "${{ secrets.GHAYMAH_TOKEN }}" | docker login ghaymah.systems -u ${{ secrets.GHAYMAH_USERNAME }} --password-stdin + + - name: Build Docker Image + run: | + docker build -t ghaymah.systems/my-api:${{ github.sha }} . + + - name: Push Docker Image + run: | + docker push ghaymah.systems/my-api:${{ github.sha }} + + deploy-staging: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Deploy to Staging + run: | + echo "Deploying application to Staging environment..." + + deploy-production: + needs: deploy-staging + + runs-on: ubuntu-latest + + environment: + name: production + + steps: + - name: Deploy to Production + run: | + echo "Deploying application to Production..."