updated workflows.

This commit is contained in:
2025-10-26 09:00:38 -04:00
parent 4c101b569b
commit cca46ee2a2
2 changed files with 22 additions and 24 deletions

View File

@@ -1,9 +1,9 @@
name: Deploy to Swarm
name: Deploy Stack to Swarm
on:
push:
branches:
- main # Only deploys from main branch (staging is safe!)
- main
paths:
- 'stacks/**/stack.yml'
@@ -20,7 +20,7 @@ jobs:
id: changes
run: |
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
echo "⚠️ Initial commit - skipping auto-deploy"
echo "⚠️ Initial commit - skipping"
echo "changed=" >> $GITHUB_OUTPUT
exit 0
fi
@@ -31,27 +31,8 @@ jobs:
- name: Deploy changed stacks
if: steps.changes.outputs.changed != ''
run: |
echo "📋 Changed stacks:"
echo "${{ steps.changes.outputs.changed }}"
for file in ${{ steps.changes.outputs.changed }}; do
stack_name=$(basename $(dirname "$file"))
echo "🚀 Deploying: $stack_name"
if docker stack deploy -c "$file" "$stack_name" --with-registry-auth; then
echo "✅ $stack_name deployed"
else
echo "❌ $stack_name failed"
exit 1
fi
done
- name: Show deployment status
if: always()
run: |
echo "📊 Current stacks:"
docker stack ls
echo ""
echo "📦 Services:"
docker service ls
docker stack deploy -c "$file" "$stack_name" --with-registry-auth
done

View File

@@ -0,0 +1,17 @@
name: Reload Caddy Proxy
on:
workflow_run:
workflows: ["Deploy Stack to Swarm"]
types:
- completed
jobs:
reload:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Restart Caddy
run: |
echo "🔄 Restarting Caddy..."
docker service update --force caddy_caddy