From 1e142f1de40dbcb54689b0c3a541dfd41593b9c3 Mon Sep 17 00:00:00 2001 From: dengwenhao <1403595435@qq.com> Date: Mon, 27 Jul 2026 07:52:16 +0000 Subject: [PATCH] Use production host runner for deployment --- .gitea/workflows/deploy.yml | 46 ++++++------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 84e5480..d3797ed 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -8,54 +8,22 @@ on: jobs: deploy: - runs-on: ubuntu-latest + runs-on: todolist-production timeout-minutes: 20 steps: - - name: Verify runner prerequisites + - name: Verify production runner shell: bash run: | set -Eeuo pipefail - command -v bash >/dev/null - command -v ssh >/dev/null - command -v base64 >/dev/null + + test "$(id -un)" = "scaiuser" + test -x /home/scaiuser/dwh_apps/fastapi-todolist/scripts/ci-deploy-entrypoint.sh + systemctl --user is-active todolist-gitea-runner.service - name: Deploy production shell: bash - env: - DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} - DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }} - DEPLOY_USER: ${{ secrets.DEPLOY_USER }} - DEPLOY_SSH_KEY_B64: ${{ secrets.DEPLOY_SSH_KEY_B64 }} - DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }} run: | set -Eeuo pipefail - umask 077 - test -n "$DEPLOY_HOST" - test -n "$DEPLOY_PORT" - test -n "$DEPLOY_USER" - test -n "$DEPLOY_SSH_KEY_B64" - test -n "$DEPLOY_KNOWN_HOSTS" - - SSH_DIR="$(mktemp -d)" - trap 'rm -rf -- "$SSH_DIR"' EXIT HUP INT TERM - - printf '%s' "$DEPLOY_SSH_KEY_B64" | - base64 --decode > "$SSH_DIR/id_ed25519" - - printf '%s\n' "$DEPLOY_KNOWN_HOSTS" \ - > "$SSH_DIR/known_hosts" - - chmod 600 "$SSH_DIR/id_ed25519" - chmod 600 "$SSH_DIR/known_hosts" - - ssh \ - -p "$DEPLOY_PORT" \ - -i "$SSH_DIR/id_ed25519" \ - -o BatchMode=yes \ - -o IdentitiesOnly=yes \ - -o StrictHostKeyChecking=yes \ - -o UserKnownHostsFile="$SSH_DIR/known_hosts" \ - "$DEPLOY_USER@$DEPLOY_HOST" \ - /home/scaiuser/dwh_apps/fastapi-todolist/scripts/ci-deploy-entrypoint.sh + /home/scaiuser/dwh_apps/fastapi-todolist/scripts/ci-deploy-entrypoint.sh