Refactor Docker Compose configurations and add deployment workflows for cloud-pc and mini-pc services
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
name: Deploy mini-pc
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'mini-pc/**'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Deploy changed stacks
|
||||
run: |
|
||||
ssh -o StrictHostKeyChecking=no ${{ secrets.MINI-PC_USER }}@${{ secrets.MINI-PC_HOST }} << 'ENDSSH'
|
||||
cd /opt/services
|
||||
git pull
|
||||
for dir in $(git diff --name-only HEAD~1 HEAD | grep '^mini-pc/' | cut -d/ -f2 | sort -u); do
|
||||
echo "==> Deploying $dir"
|
||||
cd /opt/services/mini-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