更新 entrypoint.sh
Some checks failed
v1 version / test scp action (push) Has been cancelled
v1 version / test deploy artifact (push) Has been cancelled
v1 version / test changed-files (push) Has been cancelled
v1 version / test target folder (push) Has been cancelled
v1 version / test Multiple Host (push) Has been cancelled
lint and test / test scp action (push) Has been cancelled
lint and test / test deploy artifact (push) Has been cancelled
lint and test / test changed-files (push) Has been cancelled
lint and test / test target folder (push) Has been cancelled
lint and test / test Multiple Host (push) Has been cancelled
Some checks failed
v1 version / test scp action (push) Has been cancelled
v1 version / test deploy artifact (push) Has been cancelled
v1 version / test changed-files (push) Has been cancelled
v1 version / test target folder (push) Has been cancelled
v1 version / test Multiple Host (push) Has been cancelled
lint and test / test scp action (push) Has been cancelled
lint and test / test deploy artifact (push) Has been cancelled
lint and test / test changed-files (push) Has been cancelled
lint and test / test target folder (push) Has been cancelled
lint and test / test Multiple Host (push) Has been cancelled
使用本地drone-scp
This commit is contained in:
@@ -5,50 +5,16 @@ set -euo pipefail
|
||||
export GITHUB="true"
|
||||
|
||||
GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
|
||||
DRONE_SCP_RELEASE_URL="${DRONE_SCP_RELEASE_URL:-https://github.com/appleboy/drone-scp/releases/download}"
|
||||
DRONE_SCP_VERSION="${DRONE_SCP_VERSION:-1.8.0}"
|
||||
|
||||
function log_error() {
|
||||
echo "$1" >&2
|
||||
exit "$2"
|
||||
}
|
||||
# 直接将 TARGET 定义为我们自己放在仓库里的 drone-scp 文件
|
||||
TARGET="${GITHUB_ACTION_PATH}/drone-scp"
|
||||
|
||||
function detect_client_info() {
|
||||
CLIENT_PLATFORM="${SCP_CLIENT_OS:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
|
||||
CLIENT_ARCH="${SCP_CLIENT_ARCH:-$(uname -m)}"
|
||||
|
||||
case "${CLIENT_PLATFORM}" in
|
||||
darwin | linux | windows) ;;
|
||||
*) log_error "Unknown or unsupported platform: ${CLIENT_PLATFORM}. Supported platforms are Linux, Darwin, and Windows." 2 ;;
|
||||
esac
|
||||
|
||||
case "${CLIENT_ARCH}" in
|
||||
x86_64* | i?86_64* | amd64*) CLIENT_ARCH="amd64" ;;
|
||||
aarch64* | arm64*) CLIENT_ARCH="arm64" ;;
|
||||
*) log_error "Unknown or unsupported architecture: ${CLIENT_ARCH}. Supported architectures are x86_64, i686, and arm64." 3 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
detect_client_info
|
||||
DOWNLOAD_URL_PREFIX="${DRONE_SCP_RELEASE_URL}/v${DRONE_SCP_VERSION}"
|
||||
CLIENT_BINARY="drone-scp-${DRONE_SCP_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
|
||||
TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
|
||||
echo "Downloading ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
|
||||
INSECURE_OPTION=""
|
||||
if [[ "${INPUT_CURL_INSECURE}" == 'true' ]]; then
|
||||
INSECURE_OPTION="--insecure"
|
||||
fi
|
||||
|
||||
if [[ ! -x "${TARGET}" ]]; then
|
||||
curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
|
||||
chmod +x "${TARGET}"
|
||||
else
|
||||
echo "Binary ${CLIENT_BINARY} already exists and is executable, skipping download."
|
||||
fi
|
||||
|
||||
echo "======= CLI Version Information ======="
|
||||
echo "======= Using local CLI Version ======="
|
||||
"${TARGET}" --version
|
||||
echo "======================================="
|
||||
|
||||
# 【已移除】: 删除了所有 curl 下载相关的代码块
|
||||
|
||||
if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
|
||||
{
|
||||
echo 'stdout<<EOF'
|
||||
@@ -57,4 +23,4 @@ if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
|
||||
} >>"${GITHUB_OUTPUT}"
|
||||
else
|
||||
"${TARGET}" "$@"
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user