Skip to content

Commit 313b6e1

Browse files
committed
Add deployment step to homelab server in GitHub Actions workflow
1 parent 4d7b551 commit 313b6e1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,22 @@ jobs:
4242
- name: Push backend image
4343
run: |
4444
docker push ghcr.io/${{ github.repository_owner }}/portfolio-backend:latest
45+
46+
- name: Deploy to homelab server
47+
if: github.ref == 'refs/heads/main'
48+
uses: appleboy/ssh-action@v1.0.3
49+
with:
50+
host: ${{ secrets.HOMELAB_HOST }}
51+
username: ${{ secrets.HOMELAB_USER }}
52+
key: ${{ secrets.HOMELAB_SSH_KEY }}
53+
port: ${{ secrets.HOMELAB_SSH_PORT }}
54+
script: |
55+
set -e
56+
cd ~/projects/local-smart-portfolio
57+
echo "📥 Pulling latest images..."
58+
docker compose pull
59+
echo "🔄 Recreating containers..."
60+
docker compose up -d --force-recreate
61+
echo "🧹 Cleaning up old images..."
62+
docker image prune -f
63+
echo "✅ Deployment complete!"

0 commit comments

Comments
 (0)