diff --git a/.gitea/workflows/workflow.yaml b/.gitea/workflows/workflow.yaml index f8d0ec2..7f4a7a1 100644 --- a/.gitea/workflows/workflow.yaml +++ b/.gitea/workflows/workflow.yaml @@ -70,36 +70,20 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup SSH - uses: webfactory/ssh-agent@v0.9.0 + - name: Sync files via scp + uses: appleboy/scp-action@master with: - ssh-private-key: ${{ env.SSH_PRIVATE_KEY }} - - - name: Add host to known_hosts - run: | - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "Scanning SSH host key for $SSH_HOST:$SSH_PORT..." - ssh-keyscan -p "$SSH_PORT" -T 10 -H "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null || { - echo "::error::Failed to ssh-keyscan $SSH_HOST:$SSH_PORT" - exit 1 - } - chmod 644 ~/.ssh/known_hosts - - - name: Install rsync - run: sudo apt-get update && sudo apt-get install -y rsync - - - name: Sync files via rsync - run: | - echo "Syncing repository files to ${{ needs.prepare_deployment_vars.outputs.deploy_path }}..." - rsync -avz --progress \ - -e "ssh -p $SSH_PORT" \ - --ignore-existing \ - --exclude '.git/' \ - --exclude '.github/' \ - --exclude 'node_modules/' \ - ./ $SSH_USER@$SSH_HOST:${{ needs.prepare_deployment_vars.outputs.deploy_path }}/ - + host: ${{ env.SSH_HOST }} + username: ${{ env.SSH_USER }} + key: ${{ env.SSH_PRIVATE_KEY }} + port: ${{ env.SSH_PORT }} + source: "./" + target: "${{ needs.prepare_deployment_vars.outputs.deploy_path }}" + strip_components: 1 + exclude: | + .git/ + .github/ + node_modules/ run_docker_compose: name: Run docker-compose remotely @@ -155,4 +139,3 @@ jobs: - name: Delete deployment directory run: | ssh -p "$SSH_PORT" $SSH_USER@$SSH_HOST "if [ -d '${{ needs.prepare_deployment_vars.outputs.deploy_path }}' ]; then rm -rf '${{ needs.prepare_deployment_vars.outputs.deploy_path }}'; echo 'Directory removed.'; else echo 'Directory not found, skipping.'; fi" -