Files
linearvoid/.gitea/workflows/cd.yml
T
zwitschi 8fd80c1a4c
CD / deploy (push) Failing after 16s
CI / test (push) Successful in 1m59s
CI / docker (push) Canceled after 0s
CI / release (push) Canceled after 0s
ci: generate production .env dynamically in CD workflow and update secrets documentation
2026-08-03 19:37:35 +02:00

57 lines
1.5 KiB
YAML

name: CD
on:
push:
branches: [main]
workflow_dispatch:
jobs:
deploy:
runs-on: [ubuntu-latest]
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: git.allucanget.biz
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_TOKEN }}
- name: Prepare environment
run: |
cat > .env << 'EOF'
DATABASE_URL="${{ secrets.DATABASE_URL }}"
REDIS_URL=redis://redis:6379/0
PLAYLIST_PATH=/app/playlist/playlist.txt
HLS_SEGMENT_DURATION=6
HLS_WINDOW_SIZE=24
LOG_LEVEL=info
ADMIN_USERNAME="${{ secrets.ADMIN_USERNAME }}"
ADMIN_PASSWORD="${{ secrets.ADMIN_PASSWORD }}"
ADMIN_SESSION_TTL_HOURS=12
NGINX_PORT=80
EOF
- name: Deploy with docker-compose
run: |
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d --remove-orphans
- name: Health check
run: |
sleep 10
curl -f http://localhost:3000/health || exit 1
curl -f http://localhost:8081/health || exit 1
- name: Cleanup old images
run: |
docker image prune -f --filter "until=24h"