-
Notifications
You must be signed in to change notification settings - Fork 1
/
entrypoint.sh
66 lines (54 loc) · 1.47 KB
/
entrypoint.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
bucket='static.dotcms.com'
type=$1
test_run=$2
version="${DOTCMS_VERSION}"
aws_access_key_id="${AWS_ACCESS_KEY_ID}"
aws_secret_access_key="${AWS_SECRET_ACCESS_KEY}"
target_base='./dist-output'
test_prefix='vico'
distro_base_key='versions'
javadoc_base_key="docs/${version}/javadocs"
if [[ ${test_run} == true ]]; then
distro_base_key="${test_prefix}/${distro_base_key}"
javadoc_base_key="${test_prefix}/${javadoc_base_key}"
fi
function s3Push {
local key=$1
local object=$2
echo "
######################################################################"
ls -las ${object}
echo "Executing: /usr/local/bin/aws s3 ls ${bucket}/${key}"
aws s3 ls ${bucket}/${key}
echo "Executing: /usr/local/bin/aws s3api put-object --bucket ${bucket} --key ${key} --body ${object}"
aws s3api put-object --bucket ${bucket} --key ${key} --body ${object}
echo "Executing: /usr/local/bin/aws s3 ls ${bucket}/${key}"
aws s3 ls ${bucket}/${key}
}
function pushDistro {
local ext=$1
local distro_file="dotcms_${version}.${ext}"
s3Push ${distro_base_key}/${distro_file} ${target_base}/${distro_file}
}
function pushJavadoc {
s3Push ${javadoc_base_key} ./buils/docs/javadoc
}
case "${type}" in
distro)
pushDistro 'tar.gz'
pushDistro 'zip'
;;
javadoc)
pushJavadoc
;;
all)
pushDistro 'tar.gz'
pushDistro 'zip'
pushJavadoc
;;
*)
echo "Invalid type, it should be 'distro', 'javadoc' or 'all'"
exit 1
;;
esac