CI: deploy swarm only on main, dev stack on all branches
- Trigger on all branches (not just main/decoupling) - Swarm stack deploy gated behind main branch check - Dev stack (docker compose) always deployed - Added relations, likes, orders to build loop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ name: Build and Deploy
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, decoupling]
|
branches: ['**']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: registry.rose-ash.com:5000
|
REGISTRY: registry.rose-ash.com:5000
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for app in blog market cart events federation account; do
|
for app in blog market cart events federation account relations likes orders; do
|
||||||
IMAGE_EXISTS=\$(docker image ls -q ${{ env.REGISTRY }}/\$app:latest 2>/dev/null)
|
IMAGE_EXISTS=\$(docker image ls -q ${{ env.REGISTRY }}/\$app:latest 2>/dev/null)
|
||||||
if [ \"\$REBUILD_ALL\" = true ] || echo \"\$CHANGED\" | grep -q \"^\$app/\" || [ -z \"\$IMAGE_EXISTS\" ]; then
|
if [ \"\$REBUILD_ALL\" = true ] || echo \"\$CHANGED\" | grep -q \"^\$app/\" || [ -z \"\$IMAGE_EXISTS\" ]; then
|
||||||
echo \"Building \$app...\"
|
echo \"Building \$app...\"
|
||||||
@@ -75,13 +75,18 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
source .env
|
# Deploy swarm stack only on main branch
|
||||||
docker stack deploy -c docker-compose.yml rose-ash
|
if [ '${{ github.ref_name }}' = 'main' ]; then
|
||||||
echo 'Waiting for swarm services to update...'
|
source .env
|
||||||
sleep 10
|
docker stack deploy -c docker-compose.yml rose-ash
|
||||||
docker stack services rose-ash
|
echo 'Waiting for swarm services to update...'
|
||||||
|
sleep 10
|
||||||
|
docker stack services rose-ash
|
||||||
|
else
|
||||||
|
echo 'Skipping swarm deploy (branch: ${{ github.ref_name }})'
|
||||||
|
fi
|
||||||
|
|
||||||
# Deploy dev stack (bind-mounted source + auto-reload)
|
# Dev stack always deployed (bind-mounted source + auto-reload)
|
||||||
echo 'Deploying dev stack...'
|
echo 'Deploying dev stack...'
|
||||||
docker compose -p rose-ash-dev -f docker-compose.yml -f docker-compose.dev.yml up -d
|
docker compose -p rose-ash-dev -f docker-compose.yml -f docker-compose.dev.yml up -d
|
||||||
echo 'Dev stack deployed'
|
echo 'Dev stack deployed'
|
||||||
|
|||||||
Reference in New Issue
Block a user