From 11323977b98c23953a9564fd72c477ecfd6df229 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 28 May 2026 15:27:37 +0800 Subject: [PATCH] fix: use sshpass for password auth and add port support Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/build.yaml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 504400c..e824582 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -62,26 +62,17 @@ jobs: RUNNER_TOOL_CACHE: /toolcache steps: - - name: Install SSH client + - name: Install sshpass run: | - if ! command -v ssh &> /dev/null; then - if command -v apk &> /dev/null; then - apk add --no-cache openssh-client - elif command -v apt-get &> /dev/null; then - apt-get update && apt-get install -y openssh-client - fi + if command -v apk &> /dev/null; then + apk add --no-cache sshpass openssh-client + elif command -v apt-get &> /dev/null; then + apt-get update && apt-get install -y sshpass openssh-client fi - - name: Setup SSH key - run: | - mkdir -p ~/.ssh - echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts 2>/dev/null - - name: Deploy via SSH run: | - ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'ENDSSH' + sshpass -p '${{ secrets.DEPLOY_PASSWORD }}' ssh -o StrictHostKeyChecking=no -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'ENDSSH' cd ${{ secrets.DEPLOY_PATH }} docker compose pull docker compose up -d --remove-orphans