Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
name: Deploy Application

on:
push:
branches:
- dinura-deployment
workflow_dispatch:

permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Backend syntax check
run: |
python -m compileall integrated-backend

- name: Frontend build
run: |
npm ci --prefix integrated-frontend
npm run build --prefix integrated-frontend

deploy:
needs: ci
runs-on: ubuntu-latest
Expand All @@ -40,7 +35,6 @@ jobs:
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}

- name: SSH and deploy latest app
env:
EC2_HOST: ${{ secrets.EC2_HOST }}
Expand All @@ -53,11 +47,9 @@ jobs:
git fetch origin
git checkout dinura-deployment
git reset --hard origin/dinura-deployment

if [ ! -f .env ]; then
cp .env.example .env
fi

chmod 600 .env
if docker info >/dev/null 2>&1; then
DOCKER_CMD="docker"
Expand All @@ -67,16 +59,14 @@ jobs:
echo "Docker daemon is not accessible for deployment user"
exit 1
fi

$DOCKER_CMD compose build
$DOCKER_CMD compose up -d
$DOCKER_CMD compose ps

if curl -fsS http://127.0.0.1/api/health >/dev/null 2>&1; then
echo "Backend health check passed"
else
echo "Backend health check failed"
$DOCKER_CMD compose logs --tail 200 backend
exit 1
fi
EOF
EOF