-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci-deploy.sh
executable file
·86 lines (70 loc) · 2.07 KB
/
ci-deploy.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#------------------------------------------------------------------------
# A script to deploy binaries to various locations.
#
#------------------------------------------------------------------------
# Utility methods
fatal()
{
echo "ci-deploy.sh: fatal: $1" 1>&2
exit 1
}
info()
{
echo "ci-deploy.sh: info: $1" 1>&2
}
export PATH="${PATH}:.ci:."
#------------------------------------------------------------------------
# Determine version and whether or not this is a snapshot.
#
VERSION_NAME=$(ci-version.sh) || fatal "Could not determine project version"
VERSION_TYPE=none
echo "${VERSION_NAME}" | grep -E -- '-SNAPSHOT$'
if [ $? -eq 0 ]
then
VERSION_TYPE=snapshot
else
VERSION_TAG=$(git describe --tags HEAD --exact-match 2>/dev/null)
if [ -n "${VERSION_TAG}" ]
then
VERSION_TYPE=tag
fi
fi
info "Version to be deployed is ${VERSION_NAME}"
#------------------------------------------------------------------------
# Publish the built artifacts to wherever they need to go.
#
case ${VERSION_TYPE} in
none)
info "Current version is not a snapshot, and there is no tag"
;;
snapshot)
ci-deploy-central-snapshot.sh "${VERSION_NAME}" ||
fatal "could not deploy snapshot"
ci-deploy-git-binaries.sh ||
fatal "could not deploy git binaries"
;;
tag)
ci-deploy-central-release.sh "${VERSION_NAME}" ||
fatal "could not deploy release"
ci-deploy-git-binaries.sh ||
fatal "could not deploy git binaries"
;;
esac
#------------------------------------------------------------------------
# Run Firebase if configured.
#
if [ -f ".ci-local/deploy-firebase-apps.conf" ]
then
FIREBASE_APPLICATIONS=$(egrep -v '^#' ".ci-local/deploy-firebase-apps.conf") ||
fatal "could not list firebase applications"
ci-deploy-firebase.sh "${FIREBASE_APPLICATIONS}" ||
fatal "could not deploy firebase builds"
fi
#------------------------------------------------------------------------
# Run local deploy hooks if present.
#
if [ -f .ci-local/deploy.sh ]
then
.ci-local/deploy.sh || fatal "local deploy hook failed"
fi