Files
dropshell/publish.sh
j842 efd11657ac
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 59s
Build-Test-Publish / build (linux/arm64) (push) Failing after 2m45s
docs: Add 6, update 4 and remove 2 files
2025-08-17 21:01:38 +12:00

46 lines
1.2 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."
# 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}" upload "getbin.xyz" "${SCRIPT_DIR}/output/${PROJECT}" "${PROJECT}:latest-${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} to getbin.xyz"