test: Update 19 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 34s
Build-Test-Publish / build (linux/arm64) (push) Successful in 44s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 8s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 34s
Build-Test-Publish / build (linux/arm64) (push) Successful in 44s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 8s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s
This commit is contained in:
80
dehydrate/publish.sh
Executable file
80
dehydrate/publish.sh
Executable file
@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
ARCH=$(uname -m)
|
||||
PROJECT="dehydrate"
|
||||
OUTPUT="${SCRIPT_DIR}/output"
|
||||
|
||||
|
||||
function heading() {
|
||||
# print a heading with a line of dashe
|
||||
echo "--------------------------------"
|
||||
echo "$1"
|
||||
echo "--------------------------------"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
heading "Publishing ${PROJECT}"
|
||||
|
||||
function die() {
|
||||
heading "error: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ -n $SOS_WRITE_TOKEN ]] || die "SOS_WRITE_TOKEN not specified"
|
||||
|
||||
# clear output dir
|
||||
rm -rf "${OUTPUT}"
|
||||
mkdir -p "${OUTPUT}"
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
heading "Building ${PROJECT}"
|
||||
|
||||
# build release version
|
||||
export CMAKE_BUILD_TYPE="Release"
|
||||
|
||||
docker build \
|
||||
-t "${PROJECT}-build" \
|
||||
-f "${SCRIPT_DIR}/Dockerfile.dropshell-build" \
|
||||
--build-arg PROJECT="${PROJECT}" \
|
||||
--build-arg CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
|
||||
--output "${OUTPUT}" \
|
||||
"${SCRIPT_DIR}"
|
||||
|
||||
[ -f "${OUTPUT}/${PROJECT}" ] || die "Build failed."
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
SOS="${SCRIPT_DIR}/../sos/sos"
|
||||
[ -f "${SOS}" ] || die "Failed to find sos"
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
heading "Uploading ${PROJECT} to getbin.xyz"
|
||||
|
||||
# upload arch-specific binary
|
||||
"${SOS}" upload "getbin.xyz" "${OUTPUT}/${PROJECT}" "${PROJECT}:latest-${ARCH}"
|
||||
|
||||
# upload generic install script (ok if multiple times as we iterate through arch's)
|
||||
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/install.sh" "${PROJECT}-install:latest"
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
heading "Publishing ${PROJECT} as tool to getpkg.xyz"
|
||||
|
||||
# Create tool directory structure
|
||||
TOOLDIR="${OUTPUT}/tool"
|
||||
mkdir "${TOOLDIR}"
|
||||
cp "${OUTPUT}/${PROJECT}" "${TOOLDIR}/${PROJECT}"
|
||||
|
||||
# Use getpkg to publish the tool
|
||||
GETPKG="${SCRIPT_DIR}/../getpkg/output/getpkg"
|
||||
if [ ! -f "$GETPKG" ]; then
|
||||
GETPKG="${SCRIPT_DIR}/../getpkg/getpkg"
|
||||
fi
|
||||
|
||||
if [ -f "$GETPKG" ]; then
|
||||
"${GETPKG}" publish "${PROJECT}:${ARCH}" "${TOOLDIR}"
|
||||
else
|
||||
echo "Warning: getpkg not found, skipping tool publishing to getpkg.xyz"
|
||||
fi
|
Reference in New Issue
Block a user