forked from dingodb/dingo-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.sh
executable file
·37 lines (30 loc) · 1.27 KB
/
package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -e
readonly SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${SCRIPT_ROOT}"
# shellcheck disable=SC2155
export dist_product=$(grep "^name: " artifacts/config.yml | sed -e "s/^name: //")
# shellcheck disable=SC2155
export dist_version=$(grep "^version: " artifacts/config.yml | sed -e "s/^version: //")
function indent() { sed "s/^/ 👉 /"; }
# shellcheck disable=SC2154
installer_name=ansible-${dist_product}-${dist_version}
echo "#---------------------------------------------------------"
echo "#️ ⏳️ Creating installer: ${installer_name}"
echo "#---------------------------------------------------------"
echo "✅ Downloading artifacts"
artifacts/download.py 2>&1 | indent
echo "✅ Packaging ${installer_name}"
git archive --format=tar --prefix=${installer_name}/ HEAD -o ${installer_name}.tar
echo "✅ Adding artifacts to installer tarball"
mkdir -p ${installer_name}
ln -s ../artifacts ${installer_name}/artifacts
# shellcheck disable=SC2207
export TARBALLS=( $(artifacts/download.py resolve 2>/dev/null) )
# shellcheck disable=SC2068
for tarball in ${TARBALLS[@]}; do
echo " 👉 $(basename ${tarball})"
tar -rf ${installer_name}.tar ${installer_name}/artifacts/$(basename ${tarball})
done
rm -rf ${installer_name}
echo "😁 Done"