From 314fd70e3320f1c9884173814f89affe71b76e70 Mon Sep 17 00:00:00 2001 From: Qiu Date: Sat, 20 Jun 2026 21:45:05 +0800 Subject: [PATCH] test --- 前端/.gitea/workflows/deploy.yml | 63 ++++++++++++++++---------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/前端/.gitea/workflows/deploy.yml b/前端/.gitea/workflows/deploy.yml index 35a747c..1eebbe0 100644 --- a/前端/.gitea/workflows/deploy.yml +++ b/前端/.gitea/workflows/deploy.yml @@ -8,45 +8,44 @@ on: jobs: deploy: runs-on: ci-base + + steps: + - name: Checkout code + uses: http://192.168.31.185:3002/actions/checkout@v4 + - name: Deploy via RSYNC + run: | + set -e - steps: - - name: Checkout code - uses: http://192.168.31.185:3002/actions/checkout@v4 + SERVER_HOST="${{ secrets.SSH_HOST }}" + SERVER_USER="${{ secrets.SSH_USER }}" + SERVER_PORT="${{ secrets.SSH_PORT }}" + TARGET_DIR="${{ secrets.TARGET_DIR }}" - - name: Deploy via RSYNC - run: | - set -e + : ${SERVER_HOST:="192.168.31.185"} + : ${SERVER_USER:="shuai"} + : ${SERVER_PORT:="2222"} + : ${TARGET_DIR:="/data/apps/ci-cd/frontend"} - SERVER_HOST="${{ secrets.SSH_HOST }}" - SERVER_USER="${{ secrets.SSH_USER }}" - SERVER_PORT="${{ secrets.SSH_PORT }}" - TARGET_DIR="${{ secrets.TARGET_DIR }}" + echo "Deploy to ${SERVER_USER}@${SERVER_HOST}:${TARGET_DIR}" - : ${SERVER_HOST:="192.168.31.185"} - : ${SERVER_USER:="shuai"} - : ${SERVER_PORT:="2222"} - : ${TARGET_DIR:="/data/apps/ci-cd/frontend"} + mkdir -p ~/.ssh + chmod 700 ~/.ssh - echo "Deploy to ${SERVER_USER}@${SERVER_HOST}:${TARGET_DIR}" + printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 - mkdir -p ~/.ssh - chmod 700 ~/.ssh + ssh-keyscan -p "${SERVER_PORT}" -H "${SERVER_HOST}" >> ~/.ssh/known_hosts - printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 + ssh -i ~/.ssh/id_ed25519 -p "${SERVER_PORT}" \ + "${SERVER_USER}@${SERVER_HOST}" \ + "mkdir -p ${TARGET_DIR}" - ssh-keyscan -p "${SERVER_PORT}" -H "${SERVER_HOST}" >> ~/.ssh/known_hosts + rsync -avz --delete \ + -e "ssh -i ~/.ssh/id_ed25519 -p ${SERVER_PORT}" \ + --exclude ".git" \ + --exclude ".gitea" \ + ./ \ + "${SERVER_USER}@${SERVER_HOST}:${TARGET_DIR}/" - ssh -i ~/.ssh/id_ed25519 -p "${SERVER_PORT}" \ - "${SERVER_USER}@${SERVER_HOST}" \ - "mkdir -p ${TARGET_DIR}" - - rsync -avz --delete \ - -e "ssh -i ~/.ssh/id_ed25519 -p ${SERVER_PORT}" \ - --exclude ".git" \ - --exclude ".gitea" \ - ./ \ - "${SERVER_USER}@${SERVER_HOST}:${TARGET_DIR}/" - - echo "Deploy success" + echo "Deploy success"