From 64d9f35f27cec643393c6e4438656e8ab8dc54fa Mon Sep 17 00:00:00 2001 From: Roberto Musso Date: Sat, 11 Apr 2026 17:48:42 +0200 Subject: [PATCH] refactor: update deployment process to use SSH and clone repository --- .gitea/workflows/deploy.yaml | 38 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index bb1cc24..8516334 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -10,27 +10,35 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Deploy static files via SCP - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.SSH_HOST }} - username: ${{ secrets.SSH_USER }} - key: ${{ secrets.SSH_KEY }} - source: "index.html,privacy.html,terms.html,assets/*" - target: "/opt/adiuvai-waitlist/website/" - rm: true - - - name: Verify deployment + - name: Deploy via SSH uses: appleboy/ssh-action@v1.0.0 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_KEY }} script: | - if [ -f /opt/adiuvai-waitlist/website/index.html ]; then + set -e + DEPLOY_DIR="/opt/adiuvai-waitlist/website" + REPO_URL="https://git.muticolturano.com/${{ gitea.repository }}.git" + + # Clone latest into temp dir + cd /tmp && rm -rf website-deploy + git clone --depth 1 "${REPO_URL}" website-deploy + + # Sync files (clear contents, not the directory itself) + mkdir -p "$DEPLOY_DIR" + find "$DEPLOY_DIR" -mindepth 1 -delete + cp -r /tmp/website-deploy/index.html \ + /tmp/website-deploy/privacy.html \ + /tmp/website-deploy/terms.html \ + "$DEPLOY_DIR/" + [ -d /tmp/website-deploy/assets ] && cp -r /tmp/website-deploy/assets "$DEPLOY_DIR/" + + # Cleanup + rm -rf /tmp/website-deploy + + # Verify + if [ -f "$DEPLOY_DIR/index.html" ]; then echo "✅ Website deployed" else echo "❌ index.html not found"