release.sh: collect artifacts in intermediate dir

Collect artifacts in "tmp-..." instead of final place. If build fails in the
middle, we don't want to leave the artifacts directory with partial result.

Also remove the build directory (with Git clone) in the end.
This commit is contained in:
Boris Nagaev 2025-09-27 22:04:06 -03:00
parent 9c138039d2
commit a889fbecb3
No known key found for this signature in database

View file

@ -163,11 +163,16 @@ green " - Checking tag $1"
check_tag $1
PACKAGE=loop
ARTIFACTS_DIR="${SCRIPT_DIR}/${PACKAGE}-${TAG}"
FINAL_ARTIFACTS_DIR="${SCRIPT_DIR}/${PACKAGE}-${TAG}"
ARTIFACTS_DIR="${SCRIPT_DIR}/tmp-${PACKAGE}-${TAG}-$(date +%Y%m%d-%H%M%S)"
if [ -d "$ARTIFACTS_DIR" ]; then
red "artifacts directory ${ARTIFACTS_DIR} already exists!"
exit 1
fi
if [ -d "$FINAL_ARTIFACTS_DIR" ]; then
red "final artifacts directory ${FINAL_ARTIFACTS_DIR} already exists!"
exit 1
fi
green " - Creating artifacts directory ${ARTIFACTS_DIR}"
mkdir -p "$ARTIFACTS_DIR"
green " - Packaging vendor to ${ARTIFACTS_DIR}/vendor.tar.gz"
@ -232,6 +237,13 @@ for i in $SYS; do
done
cd "$ARTIFACTS_DIR"
green "- Producing manifest-$TAG.txt"
shasum -a 256 * > manifest-$TAG.txt
cd ..
green "- Moving artifacts directory to final place ${FINAL_ARTIFACTS_DIR}"
mv "$ARTIFACTS_DIR" "$FINAL_ARTIFACTS_DIR"
green "- Removing the subdir used for building ${BUILD_DIR}"
rm -r "$BUILD_DIR"