Files
configucci/.gitea/workflows/deploy.yml
sokol 9e313f5b86
Some checks failed
CI / build-and-test (push) Has been cancelled
CI / build-and-test (pull_request) Has been cancelled
feat: native deploy workflow without SSH
2026-02-20 13:55:53 +03:00

77 lines
1.8 KiB
YAML

name: Deploy to Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: configucci:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create docker-compose.yml
run: |
cat > docker-compose.yml << 'EOF'
version: '3.8'
services:
configucci:
image: configucci:latest
container_name: configucci
ports:
- "11088:80"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
EOF
- name: Stop existing containers
run: docker-compose down || true
- name: Start new container
run: docker-compose up -d
- name: Wait for application health
run: |
echo "Waiting for application to be healthy..."
for i in {1..30}; do
if curl -s http://localhost:11088 > /dev/null 2>&1; then
echo "Application is ready!"
exit 0
fi
sleep 2
done
echo "Application failed to start"
exit 1
- name: Cleanup old images
run: docker system prune -f