Sync dev workflow with master label-based filtering

Dev branch now only deploys stacks with stack-type=dev-only label,
matching the master workflow's approach.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 15:04:35 -05:00
parent f19577fbcc
commit d44a8c7276

View File

@@ -27,15 +27,32 @@ jobs:
STACKS=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | grep '^stacks/' | cut -d'/' -f2 | sort -u || echo "")
if [ -z "$STACKS" ]; then
echo "No stacks changed, deploying all..."
echo "No stacks changed, checking all stacks..."
STACKS=$(ls stacks/)
fi
echo "Deploying: $STACKS"
echo "Evaluating stacks: $STACKS"
echo ""
for stack in $STACKS; do
COMPOSE_FILE="stacks/$stack/docker-compose.yml"
# Check stack-type label
STACK_TYPE=$(grep -o 'stack-type=[^"]*' "$COMPOSE_FILE" 2>/dev/null | head -1 | cut -d= -f2)
if [ -z "$STACK_TYPE" ]; then
echo "⚠️ SKIP $stack - no stack-type label found"
continue
fi
# On prod, only deploy 'prod' and 'public' stacks
if [ "$STACK_TYPE" != "prod" ] && [ "$STACK_TYPE" != "public" ]; then
echo "⏭️ SKIP $stack - stack-type=$STACK_TYPE (not for prod)"
continue
fi
echo "=========================================="
echo "Deploying $stack..."
echo "Deploying $stack (stack-type=$STACK_TYPE)..."
echo "=========================================="
STACK_DIR="${{ env.STACKS_DIR }}/$stack"
@@ -44,9 +61,10 @@ jobs:
# Copy files
sudo cp -r stacks/$stack/* "$STACK_DIR/"
# Create .env from template if exists
if [ -f "$STACK_DIR/.env.template" ]; then
sudo envsubst < "$STACK_DIR/.env.template" > "$STACK_DIR/.env"
# Create .env from template if .env doesn't exist
if [ -f "$STACK_DIR/.env.template" ] && [ ! -f "$STACK_DIR/.env" ]; then
echo "Creating .env from template..."
sudo sh -c "DOMAIN=$DOMAIN envsubst < '$STACK_DIR/.env.template' > '$STACK_DIR/.env'"
fi
# Deploy
@@ -59,11 +77,11 @@ jobs:
done
- name: Show running containers
run: sudo docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | head -20
run: sudo docker ps --format "table {{.Names}}\t{{.Status}}" | head -30
deploy-dev:
if: ${{ github.ref == 'refs/heads/dev' }}
runs-on: ubuntu-dev
runs-on: ubuntu-dev:host
steps:
- uses: actions/checkout@v4
with:
@@ -77,15 +95,32 @@ jobs:
STACKS=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | grep '^stacks/' | cut -d'/' -f2 | sort -u || echo "")
if [ -z "$STACKS" ]; then
echo "No stacks changed, deploying all..."
echo "No stacks changed, checking all stacks..."
STACKS=$(ls stacks/)
fi
echo "Deploying: $STACKS"
echo "Evaluating stacks: $STACKS"
echo ""
for stack in $STACKS; do
COMPOSE_FILE="stacks/$stack/docker-compose.yml"
# Check stack-type label
STACK_TYPE=$(grep -o 'stack-type=[^"]*' "$COMPOSE_FILE" 2>/dev/null | head -1 | cut -d= -f2)
if [ -z "$STACK_TYPE" ]; then
echo "⚠️ SKIP $stack - no stack-type label found"
continue
fi
# On dev, only deploy 'dev-only' stacks
if [ "$STACK_TYPE" != "dev-only" ]; then
echo "⏭️ SKIP $stack - stack-type=$STACK_TYPE (not for dev)"
continue
fi
echo "=========================================="
echo "Deploying $stack..."
echo "Deploying $stack (stack-type=$STACK_TYPE)..."
echo "=========================================="
STACK_DIR="${{ env.STACKS_DIR }}/$stack"
@@ -94,9 +129,10 @@ jobs:
# Copy files
sudo cp -r stacks/$stack/* "$STACK_DIR/"
# Create .env from template if exists
if [ -f "$STACK_DIR/.env.template" ]; then
sudo envsubst < "$STACK_DIR/.env.template" > "$STACK_DIR/.env"
# Create .env from template if .env doesn't exist
if [ -f "$STACK_DIR/.env.template" ] && [ ! -f "$STACK_DIR/.env" ]; then
echo "Creating .env from template..."
sudo sh -c "DOMAIN=$DOMAIN envsubst < '$STACK_DIR/.env.template' > '$STACK_DIR/.env'"
fi
# Deploy
@@ -109,4 +145,4 @@ jobs:
done
- name: Show running containers
run: sudo docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | head -20
run: sudo docker ps --format "table {{.Names}}\t{{.Status}}" | head -30