ci: avoid deleting checkout source during rsync
Some checks failed
Cross Build Windows Release on Linux / cross-build-windows (push) Failing after 16s
Build Windows Release / build-windows (push) Has been cancelled

This commit is contained in:
luochen570
2026-05-30 00:46:13 +08:00
parent ae12b48973
commit 1e34b10542

View File

@@ -34,16 +34,18 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
dnf install -y git rsync 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" REPO_URL="${GITHUB_SERVER_URL:-https://git.luochen570.cn}/${GITHUB_REPOSITORY}.git"
TOKEN="${GITHUB_TOKEN:-${GITEA_TOKEN:-}}" TOKEN="${GITHUB_TOKEN:-}"
if [ -n "$TOKEN" ]; then if [ -n "$TOKEN" ]; then
git -c http.extraHeader="Authorization: token ${TOKEN}" \ 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 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 fi
rsync -a --delete source/ ./ rsync -a --delete "$SRC_DIR/" "$WORKDIR/"
rm -rf source rm -rf "$SRC_DIR"
- name: Install cross build dependencies - name: Install cross build dependencies
run: | run: |