ci: avoid deleting checkout source during rsync
This commit is contained in:
@@ -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: |
|
||||||
|
|||||||
Reference in New Issue
Block a user