getpkg/dropshell-tool/publish.sh
Your Name 4b7ec3cacf
Some checks failed
dropshell-build / build (push) Has been cancelled
'Generic Commit'
2025-05-31 22:02:26 +12:00

50 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
die() {
echo -e "Error: $1" >&2
exit 1
}
function publish_install() {
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-tool-install" "dropshell-tool-install"
}
function publish_executables() {
OUTPUT_DIR="${SCRIPT_DIR}/output"
ARCH=$(uname -m)
# Find all dropshell-tool.ARCH files in output/
TOOLS=()
for tool in "${SCRIPT_DIR}/output/"/*dropshell-tool.*; do
[ -f "$tool" ] || continue
tool_name=$(basename "$tool")
TOOLS+=("$tool_name")
done
if [ ${#TOOLS[@]} -eq 0 ]; then
echo "No tools found in ${SCRIPT_DIR}/output/. Exiting."
exit 1
fi
for TOOL in "${TOOLS[@]}"; do
echo "Publishing $TOOL"
# extract the architecture from the tool name
ARCH="${TOOL//dropshell-tool./}"
# upload the tool
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-tool:${ARCH}" "$OUTPUT_DIR/$TOOL"
done
}
publish_install
publish_executables
echo "Done"