add release assets workflow

This commit is contained in:
2025-10-19 01:08:03 -07:00
parent a7098cfc20
commit 232efc2859
7 changed files with 92 additions and 1 deletions

17
hack/assemble.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
cd "$(dirname "${0}")/.." || exit 1
. "hack/common.sh"
mkdir -p "${ASSEMBLE_DIR}"
build_arch() {
ARCHITECTURE="${1}"
TARGET_ARCH="${ARCHITECTURE}" ./hack/build.sh
cp "target/final/${ARCHITECTURE}/sprout.efi" "${ASSEMBLE_DIR}/sprout-${ARCHITECTURE}.efi"
}
build_arch x86_64
build_arch aarch64

11
hack/build.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -e
cd "$(dirname "${0}")/.." || exit 1
. "hack/common.sh"
mkdir -p "${FINAL_DIR}"
cargo build --target "${RUST_TARGET}" --profile "${RUST_PROFILE}" --bin sprout
cp "target/${RUST_TARGET}/${RUST_TARGET_SUBDIR}/sprout.efi" "${FINAL_DIR}/sprout.efi"

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
retry() {
for i in $(seq 1 10); do
if "${@}"; then
return 0
else
sleep "${i}"
fi
done
"${@}"
}
TAG="${1}"
shift
cd target/assemble
retry gh release upload "${TAG}" --clobber ./*

View File

@@ -20,7 +20,7 @@ HOST_ARCH="$(uname -m)"
[ "${TARGET_ARCH}" = "amd64" ] && TARGET_ARCH="x86_64"
if [ "${TARGET_ARCH}" != "x86_64" ] && [ "${TARGET_ARCH}" != "aarch64" ]; then
echo "Unsupported Architecture: ${TARGET_ARCH}" >/dev/stderr
echo "Unsupported architecture: ${TARGET_ARCH}" >/dev/stderr
exit 1
fi
@@ -34,6 +34,7 @@ RUST_TARGET="${TARGET_ARCH}-unknown-uefi"
[ -z "${DOCKER_TAG}" ] && DOCKER_TAG="${DEFAULT_DOCKER_TAG}"
DOCKER_TARGET="linux/${TARGET_ARCH}"
FINAL_DIR="target/final/${TARGET_ARCH}"
ASSEMBLE_DIR="target/assemble"
if [ -z "${QEMU_ACCEL}" ] && [ "${TARGET_ARCH}" = "${HOST_ARCH}" ] &&
[ -f "/proc/cpuinfo" ] &&