This repository has been archived on 2025-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
ssh-action/entrypoint.sh
wangdepei 1423f391fb
Some checks failed
testing main branch / check-ssh-key (push) Waiting to run
testing main branch / support-key-passphrase (push) Waiting to run
testing main branch / multiple-server (push) Waiting to run
testing main branch / support-ed25519-key (push) Waiting to run
testing main branch / testing-with-env (push) Waiting to run
testing main branch / testing ipv6 (push) Waiting to run
testing main branch / some special character (push) Waiting to run
testing main branch / testing-capturing-output (push) Waiting to run
testing main branch / testing-script-stop (push) Waiting to run
testing main branch / testing-script-error (push) Waiting to run
testing stable version / check-ssh-key (push) Waiting to run
testing stable version / support-key-passphrase (push) Waiting to run
testing stable version / multiple-server (push) Waiting to run
testing stable version / support-ed25519-key (push) Waiting to run
testing stable version / testing-with-env (push) Waiting to run
testing stable version / default-user-name-password (push) Has been cancelled
testing main branch / default-user-name-password (push) Has been cancelled
add drone-ssh-1.8.1-linux-amd64 to void download binary from github
2025-06-17 16:36:22 +08:00

58 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
export GITHUB="true"
# GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
# DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
# DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.1}"
function log_error() {
echo "$1" >&2
exit "$2"
}
function detect_client_info() {
CLIENT_PLATFORM="${SSH_CLIENT_OS:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
CLIENT_ARCH="${SSH_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_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
# CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
# TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
TARGET="drone-ssh-1.8.1-linux-amd64"
# echo "Downloading ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
# INSECURE_OPTION=""
# if [[ "${INPUT_CURL_INSECURE}" == 'true' ]]; then
# INSECURE_OPTION="--insecure"
# fi
# curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
chmod +x "${TARGET}"
echo "======= CLI Version Information ======="
"${TARGET}" --version
echo "======================================="
if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
{
echo 'stdout<<EOF'
"${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
echo 'EOF'
} >>"${GITHUB_OUTPUT}"
else
"${TARGET}" "$@"
fi