Add CI and deployment workflows for Gitea
Some checks failed
CI / quality-checks (push) Successful in 42s
Deploy / deploy (push) Failing after 1m7s

This commit is contained in:
2026-03-31 17:26:11 +02:00
parent 9f73077207
commit 64694d94f2
5 changed files with 101 additions and 5 deletions

View File

@@ -0,0 +1,57 @@
name: Deploy
on:
push:
branches: ["main"]
workflow_run:
workflows: ["CI"]
types:
- completed
branches: ["main"]
jobs:
deploy:
runs-on: ubuntu-latest
# Only deploy if CI workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Stop existing containers
run: |
# Stop and remove existing containers if they exist
docker compose down --remove-orphans || true
- name: Build and deploy with Docker Compose
run: |
# Build images
docker compose build
# Deploy the stack in detached mode
export GOOGLE_BOOKS_API_KEY="${{ secrets.GOOGLE_BOOKS_API_KEY }}"
docker compose up -d
# Wait for health checks to pass
echo "Waiting for application to be healthy..."
timeout 300 sh -c 'until docker compose ps | grep -q "healthy"; do sleep 5; done'
- name: Verify deployment
run: |
# Check if all services are running
docker compose ps
# Test if the application responds
sleep 10
wget --spider --no-check-certificate https://172.17.0.1:5123 || exit 1
echo "Deployment successful!"
- name: Cleanup old images
run: |
# Remove dangling images to save space
docker image prune -f