49 أسطر
1.0 KiB
YAML
49 أسطر
1.0 KiB
YAML
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..."
|