ac8562ea51
- PR workflow: build, deploy to CI site, wait for health, run acceptance tests - Release workflow: deploy to dev using mounted compose path with health check - Add deploy-prod workflow (workflow_dispatch) for human-gated prod deployment - Add just recipes: deploy-prod, status (view current image tags across envs) - Runners now have /apps mount for access to all environment compose files
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
name: Deploy Production
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version tag to deploy (e.g., v0.1.21)'
|
|
required: true
|
|
type: string
|
|
|
|
env:
|
|
REGISTRY: docker.notsosm.art
|
|
IMAGE_NAME: euchre-camp
|
|
PROD_APPS_PATH: /apps/youthful_simon
|
|
|
|
jobs:
|
|
deploy-prod:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker.notsosm.art/euchre-camp/ci-base:latest
|
|
options: --user root
|
|
|
|
steps:
|
|
- name: Deploy to production
|
|
run: |
|
|
VERSION="${{ inputs.version }}"
|
|
COMPOSE_FILE="${{ env.PROD_APPS_PATH }}/docker-compose.yml"
|
|
|
|
echo "Deploying ${VERSION} to production..."
|
|
|
|
# Update prod compose file with the release tag
|
|
# Note: Standardizing to docker.notsosm.art registry
|
|
sed -i "s|image: euchre-camp/euchre-camp:[a-zA-Z0-9.-]*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}|" ${COMPOSE_FILE}
|
|
sed -i "s|image: docker.notsosm.art/euchre-camp:[a-zA-Z0-9.-]*|image: docker.notsosm.art/euchre-camp:${VERSION}|" ${COMPOSE_FILE}
|
|
|
|
# Pull and restart the prod container
|
|
cd ${{ env.PROD_APPS_PATH }}
|
|
docker compose pull app
|
|
docker compose up -d app
|
|
|
|
# Wait for production site to be healthy
|
|
echo "Waiting for production site to be healthy..."
|
|
for i in {1..30}; do
|
|
if curl -sf https://euchre.notsosm.art/api/health > /dev/null 2>&1; then
|
|
echo "✅ Production successfully deployed with version ${VERSION}"
|
|
exit 0
|
|
fi
|
|
sleep 0.5
|
|
done
|
|
echo "❌ Production deployment failed"
|
|
docker compose logs app
|
|
exit 1 |