From d3b57009770eac80782b0ea1484857738600b925 Mon Sep 17 00:00:00 2001 From: M3ow <3+m3ow@noreply.git@immortal.host> Date: Sun, 2 Aug 2026 18:39:08 -0400 Subject: [PATCH] Add .gitea/workflows/git-to-ptero.yaml --- .gitea/workflows/git-to-ptero.yaml | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitea/workflows/git-to-ptero.yaml diff --git a/.gitea/workflows/git-to-ptero.yaml b/.gitea/workflows/git-to-ptero.yaml new file mode 100644 index 0000000..2bcb26c --- /dev/null +++ b/.gitea/workflows/git-to-ptero.yaml @@ -0,0 +1,42 @@ +name: Push to SFTP + +on: + workflow_dispatch: + # push: + # branches: + # - main # Optional: Run automatically on pushes to the main branch + +jobs: + deploy-to-sftp: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Install lftp and ssh + run: sudo apt-get update && sudo apt-get install -y lftp openssh-client + + - name: Set up SSH Private Key + env: + # Binds the secret to a secure environment variable + SSH_PRIVATE_KEY: ${{ secrets.SSH }} + run: | + mkdir -p ~/.ssh + # Uses the environment variable, so the raw key is never printed in the execution log + echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + + - name: Push files via SFTP with progress + run: | + # The mirror command below uses the -R (reverse) flag + # to push from local './' to remote './' + # Connection is made using 'open' inside the execution block to enforce SSH key usage + lftp -e "set sftp:connect-program 'ssh -a -x -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -o BatchMode=yes -o PasswordAuthentication=no'; \ + set sftp:auto-confirm yes; \ + set net:max-retries 5; \ + set net:timeout 30; \ + set cmd:fail-exit yes; \ + open -u ${{ secrets.SSH_USER }}, sftp://10.1.17.20:2022; \ + mirror -R --verbose --parallel=4 ./ ./; \ + quit" \ No newline at end of file