Add Gitea Actions workflow for auto-deployment
Some checks failed
Deploy to Server / deploy (push) Has been cancelled
Some checks failed
Deploy to Server / deploy (push) Has been cancelled
Replace webhook-based deployment with Gitea Actions workflow. On push to main, the workflow will: - SSH into the server - Pull latest code - Rebuild and restart Docker containers Required secrets in Gitea: - SERVER_HOST - SERVER_USER - SERVER_SSH_KEY - SERVER_PORT 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
40
.gitea/workflows/deploy.yaml
Normal file
40
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Deploy to Server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy to server via SSH
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USER }}
|
||||
key: ${{ secrets.SERVER_SSH_KEY }}
|
||||
port: ${{ secrets.SERVER_PORT }}
|
||||
script: |
|
||||
cd /home/bini/shorts-maker
|
||||
|
||||
echo "=== Pulling latest code ==="
|
||||
git fetch origin
|
||||
git reset --hard origin/main
|
||||
|
||||
echo "=== Rebuilding Docker containers ==="
|
||||
docker compose build --no-cache
|
||||
|
||||
echo "=== Restarting containers ==="
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
|
||||
echo "=== Cleaning up old images ==="
|
||||
docker image prune -f
|
||||
|
||||
echo "=== Deployment completed ==="
|
||||
docker compose ps
|
||||
Reference in New Issue
Block a user