updated workflows.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user