refactor: unify build/release workflows into a single parameterized workflow
Replace 4 separate workflows (docker-build-self, docker-build-origin, release-self-binaries, release-origin-binaries) with one build-and-release.yml that accepts repository, ref, docker_tag, and release_tag as inputs. - origin/Dockerfile: now copies pre-built binary like self/Dockerfile - origin/build.sh: clones tiann/hapi@main and builds before docker build via HAPI Co-Authored-By: HAPI <[email protected]>
This commit is contained in:
@@ -7,9 +7,11 @@ ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
HAPI_ARCH="amd64"
|
||||
BINARY_DIR="bun-linux-x64-baseline"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
HAPI_ARCH="arm64"
|
||||
BINARY_DIR="bun-linux-arm64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
@@ -17,10 +19,30 @@ case "$ARCH" in
|
||||
;;
|
||||
esac
|
||||
|
||||
BUILD_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "$BUILD_DIR"' EXIT
|
||||
|
||||
echo "Cloning tiann/hapi@main into $BUILD_DIR ..."
|
||||
git clone --depth 1 --branch main https://github.com/tiann/hapi.git "$BUILD_DIR"
|
||||
|
||||
cd "$BUILD_DIR"
|
||||
bun install
|
||||
bun run build:single-exe
|
||||
|
||||
BINARY_PATH="$BUILD_DIR/cli/dist-exe/$BINARY_DIR/hapi"
|
||||
if [ ! -f "$BINARY_PATH" ]; then
|
||||
echo "Binary not found: $BINARY_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$BINARY_PATH" "$SCRIPT_DIR/hapi-${HAPI_ARCH}"
|
||||
|
||||
docker build \
|
||||
--build-arg "TARGETARCH=${HAPI_ARCH}" \
|
||||
-t "hapi:origin" \
|
||||
-f "$SCRIPT_DIR/Dockerfile" \
|
||||
"$SCRIPT_DIR/"
|
||||
|
||||
rm -f "$SCRIPT_DIR/hapi-${HAPI_ARCH}"
|
||||
|
||||
echo "Built hapi:origin for ${HAPI_ARCH}"
|
||||
|
||||
Reference in New Issue
Block a user