Files
getpkg/dehydrate/build.sh
Your Name 17224c4637
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 7s
Build-Test-Publish / build (linux/arm64) (push) Failing after 7s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped
Update 2 files
2025-06-30 19:35:14 +12:00

36 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Get script directory - handle different execution contexts
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT="$(basename "$(dirname "${SCRIPT_DIR}")")"
# Debug output for CI
echo "${PROJECT} build script running from: ${SCRIPT_DIR}"
MOUNT_CMD="-v ${SCRIPT_DIR}:/app -w /app"
if [ -n "${GITEA_CONTAINER_NAME:-}" ]; then
echo "We're in a gitea container: ${GITEA_CONTAINER_NAME}"
MOUNT_CMD="--volumes-from=${GITEA_CONTAINER_NAME} -w ${GITHUB_WORKSPACE}/${PROJECT}"
fi
# Run build in container with mounted directories
COMMAND_TO_RUN="cmake -G Ninja -S . -B ./build \
-DCMAKE_BUILD_TYPE=\${CMAKE_BUILD_TYPE} \
-DPROJECT_NAME=${PROJECT} && \
cmake --build ./build"
echo "Building in new docker container"
docker run --rm \
--user "$(id -u):$(id -g)" \
${MOUNT_CMD} \
-e CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Debug}" \
gitea.jde.nz/public/dropshell-build-base:latest \
bash -c "cd /app && ${COMMAND_TO_RUN}"
[ -f "./build/${PROJECT}" ] && cp "./build/${PROJECT}" ./output/ || echo "No output file found"
echo "Build complete"