From 79b46e27d6dd054aac8c281ac6897a65d9549f9e Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 6 Sep 2022 19:55:22 +0200 Subject: Split the deploy script in distinct tasks --- common/git-clone.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 common/git-clone.sh (limited to 'common/git-clone.sh') diff --git a/common/git-clone.sh b/common/git-clone.sh new file mode 100644 index 0000000..1a1a89c --- /dev/null +++ b/common/git-clone.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Input environment: +# - NAME: a name for the script/tasks +# - URL: the url of the repository to clone + +WORKDIR="/tmp/${NAME}" + +cleanup() { + rm -rf "${WORKDIR}" +} + +trap cleanup EXIT + +git clone -q "${URL}" "${WORKDIR}" + +trap - EXIT -- cgit v1.2.3