Refactor deployment script for cloud-pc to remove unnecessary SSH command and streamline stack deployment process
This commit is contained in:
@@ -14,18 +14,17 @@ jobs:
|
|||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- name: Deploy changed stacks
|
- name: Deploy changed stacks
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=no ${{ secrets.CLOUD-PC_USER }}@${{ secrets.CLOUD-PC_HOST }} << 'ENDSSH'
|
cd /opt/services
|
||||||
|
git pull
|
||||||
|
for dir in $(git diff --name-only HEAD~1 HEAD | grep '^cloud-pc/' | cut -d/ -f2 | sort -u); do
|
||||||
|
echo "==> Deploying $dir"
|
||||||
|
cd /opt/services/cloud-pc/$dir
|
||||||
|
test -f docker-compose.yml || { echo "No docker-compose.yml in $dir, skipping"; cd /opt/services; continue; }
|
||||||
|
if grep -qE '^[[:space:]]*build:' docker-compose.yml; then
|
||||||
|
docker compose up -d --build --remove-orphans
|
||||||
|
else
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d --remove-orphans
|
||||||
|
fi
|
||||||
cd /opt/services
|
cd /opt/services
|
||||||
git pull
|
done
|
||||||
for dir in $(git diff --name-only HEAD~1 HEAD | grep '^cloud-pc/' | cut -d/ -f2 | sort -u); do
|
|
||||||
echo "==> Deploying $dir"
|
|
||||||
cd /opt/services/cloud-pc/$dir
|
|
||||||
if grep -qE '^[[:space:]]*build:' docker-compose.yml; then
|
|
||||||
docker compose up -d --build --remove-orphans
|
|
||||||
else
|
|
||||||
docker compose pull
|
|
||||||
docker compose up -d --remove-orphans
|
|
||||||
fi
|
|
||||||
cd /opt/services
|
|
||||||
done
|
|
||||||
ENDSSH
|
|
||||||
|
|||||||
Reference in New Issue
Block a user