From 1e34b10542b3bfeee195f7fdaa9a103a18500826 Mon Sep 17 00:00:00 2001 From: luochen570 <1160510664@qq.com> Date: Sat, 30 May 2026 00:46:13 +0800 Subject: [PATCH] ci: avoid deleting checkout source during rsync --- .gitea/workflows/build-windows-cross-linux.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/build-windows-cross-linux.yml b/.gitea/workflows/build-windows-cross-linux.yml index d8ebea8..02b1576 100644 --- a/.gitea/workflows/build-windows-cross-linux.yml +++ b/.gitea/workflows/build-windows-cross-linux.yml @@ -34,16 +34,18 @@ jobs: run: | set -euo pipefail dnf install -y git rsync + WORKDIR="$(pwd)" + SRC_DIR="$(mktemp -d /tmp/chengnan-source.XXXXXX)" REPO_URL="${GITHUB_SERVER_URL:-https://git.luochen570.cn}/${GITHUB_REPOSITORY}.git" - TOKEN="${GITHUB_TOKEN:-${GITEA_TOKEN:-}}" + TOKEN="${GITHUB_TOKEN:-}" if [ -n "$TOKEN" ]; then git -c http.extraHeader="Authorization: token ${TOKEN}" \ - clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" "$REPO_URL" source + clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" "$REPO_URL" "$SRC_DIR" else - git clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" "$REPO_URL" source + git clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" "$REPO_URL" "$SRC_DIR" fi - rsync -a --delete source/ ./ - rm -rf source + rsync -a --delete "$SRC_DIR/" "$WORKDIR/" + rm -rf "$SRC_DIR" - name: Install cross build dependencies run: |