56 lines
1.7 KiB
Bash
Executable File
56 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
ARCH=$(uname -m)
|
|
TEMP_DIR="${SCRIPT_DIR}/temp"
|
|
SOS="${TEMP_DIR}/sos"
|
|
PROJECT="dropshell"
|
|
|
|
echo "Publishing dropshell to getbin.xyz"
|
|
|
|
function die() {
|
|
echo "error: $1"
|
|
exit 1
|
|
}
|
|
|
|
[[ -n ${SOS_WRITE_TOKEN:-} ]] || die "SOS_WRITE_TOKEN not specified"
|
|
|
|
# clear output dir
|
|
rm -rf "${SCRIPT_DIR}/output"
|
|
mkdir -p "${SCRIPT_DIR}/output"
|
|
|
|
# build release version
|
|
export CMAKE_BUILD_TYPE="Release"
|
|
export INSTALL_LOCAL="false"
|
|
"${SCRIPT_DIR}/build.sh"
|
|
|
|
[ -f "${SCRIPT_DIR}/output/dropshell" ] || die "Build failed."
|
|
|
|
# Get version from the built binary (format: YYYY.MMDD.HHMM)
|
|
VERSION=$("${SCRIPT_DIR}/output/dropshell" version | tr -d '[:space:]')
|
|
[ -z "$VERSION" ] && die "Failed to get version from dropshell"
|
|
|
|
echo "Publishing dropshell version ${VERSION} for ${ARCH}"
|
|
|
|
# download the sos binary
|
|
mkdir -p "${TEMP_DIR}"
|
|
trap 'rm -rf "${TEMP_DIR}"' EXIT
|
|
|
|
curl -L -o "${SOS}" "https://getbin.xyz/sos"
|
|
chmod +x "${SOS}"
|
|
|
|
# Upload arch-specific binary
|
|
# sos will automatically run "dropshell version" and store it in metadata
|
|
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/output/${PROJECT}" "${PROJECT}:latest-${ARCH}"
|
|
|
|
# Also upload with version-specific tag for direct version access
|
|
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/output/${PROJECT}" "${PROJECT}:${VERSION}-${ARCH}"
|
|
|
|
# upload generic install script
|
|
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/dropshell-install.sh" "dropshell-install:latest"
|
|
|
|
# upload server auto-setup script
|
|
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/dropshell-server-autosetup.sh" "dropshell-server-autosetup:latest"
|
|
|
|
echo "Successfully published dropshell:latest-${ARCH} (version ${VERSION}) to getbin.xyz" |