Skip to content

Commit a889fbe

Browse files
committed
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.
1 parent 9c13803 commit a889fbe

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

release.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,16 @@ green " - Checking tag $1"
163163
check_tag $1
164164

165165
PACKAGE=loop
166-
ARTIFACTS_DIR="${SCRIPT_DIR}/${PACKAGE}-${TAG}"
166+
FINAL_ARTIFACTS_DIR="${SCRIPT_DIR}/${PACKAGE}-${TAG}"
167+
ARTIFACTS_DIR="${SCRIPT_DIR}/tmp-${PACKAGE}-${TAG}-$(date +%Y%m%d-%H%M%S)"
167168
if [ -d "$ARTIFACTS_DIR" ]; then
168169
red "artifacts directory ${ARTIFACTS_DIR} already exists!"
169170
exit 1
170171
fi
172+
if [ -d "$FINAL_ARTIFACTS_DIR" ]; then
173+
red "final artifacts directory ${FINAL_ARTIFACTS_DIR} already exists!"
174+
exit 1
175+
fi
171176
green " - Creating artifacts directory ${ARTIFACTS_DIR}"
172177
mkdir -p "$ARTIFACTS_DIR"
173178
green " - Packaging vendor to ${ARTIFACTS_DIR}/vendor.tar.gz"
@@ -232,6 +237,13 @@ for i in $SYS; do
232237
done
233238

234239
cd "$ARTIFACTS_DIR"
235-
236240
green "- Producing manifest-$TAG.txt"
237241
shasum -a 256 * > manifest-$TAG.txt
242+
cd ..
243+
244+
green "- Moving artifacts directory to final place ${FINAL_ARTIFACTS_DIR}"
245+
mv "$ARTIFACTS_DIR" "$FINAL_ARTIFACTS_DIR"
246+
247+
green "- Removing the subdir used for building ${BUILD_DIR}"
248+
249+
rm -r "$BUILD_DIR"

0 commit comments

Comments
 (0)