This commit is contained in:
38
.gitea/workflows/deploy.yml
Normal file
38
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Deploy to VPS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Pull latest code
|
||||
run: |
|
||||
cd /opt/updatedb
|
||||
git pull origin main
|
||||
|
||||
- name: Rebuild and restart
|
||||
run: |
|
||||
cd /opt/updatedb
|
||||
docker compose up -d --build
|
||||
|
||||
- name: Verify
|
||||
run: |
|
||||
cd /opt/updatedb
|
||||
sleep 3
|
||||
if docker compose ps | grep -q "Up"; then
|
||||
echo "Deployment successful"
|
||||
else
|
||||
echo "ERROR: Container failed to start"
|
||||
docker compose logs --tail=50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Show logs
|
||||
if: always()
|
||||
run: |
|
||||
cd /opt/updatedb
|
||||
docker compose logs --tail=20
|
||||
Reference in New Issue
Block a user