Add deployment workflow
Some checks failed
Deploy All Stacks to Swarm / deploy (push) Has been cancelled
Some checks failed
Deploy All Stacks to Swarm / deploy (push) Has been cancelled
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
name: Deploy Stack to Swarm
|
name: Deploy All Stacks to Swarm
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
# Allows manual triggering
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -14,18 +14,30 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Validate compose file
|
- name: Deploy remaining stacks
|
||||||
run: |
|
run: |
|
||||||
docker compose -f stack.yml config > /dev/null
|
for stack_file in *-stack.yml; do
|
||||||
echo "✅ Compose file is valid"
|
stack_name="${stack_file%-stack.yml}"
|
||||||
|
# Skip traefik, git-runner (deploy those manually)
|
||||||
|
if [[ "$stack_name" != "traefik" && "$stack_name" != "git-runner" ]]; then
|
||||||
|
echo "🚀 Deploying ${stack_name}..."
|
||||||
|
docker stack deploy -c "$stack_file" "$stack_name" --prune --with-registry-auth
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
- name: Deploy to swarm
|
- name: Deploy remaining stacks
|
||||||
run: |
|
run: |
|
||||||
echo "🚀 Deploying stack..."
|
for stack_file in *-stack.yml; do
|
||||||
docker stack deploy -c stack.yml ${{ github.event.repository.name }} --prune --with-registry-auth
|
stack_name="${stack_file%-stack.yml}"
|
||||||
echo "✅ Stack deployed successfully"
|
# Skip if already deployed
|
||||||
|
if [[ "$stack_name" != "traefik" && "$stack_name" != "git-runner" ]]; then
|
||||||
|
echo "🚀 Deploying ${stack_name}..."
|
||||||
|
docker stack deploy -c "$stack_file" "$stack_name" --prune --with-registry-auth
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
- name: Verify deployment
|
- name: List deployed stacks
|
||||||
run: |
|
run: |
|
||||||
sleep 5
|
echo ""
|
||||||
docker stack services ${{ github.event.repository.name }}
|
echo "📋 All deployed stacks:"
|
||||||
|
docker stack ls
|
||||||
|
|||||||
Reference in New Issue
Block a user