-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·65 lines (45 loc) · 1.13 KB
/
publish.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
#!/bin/bash
set -e
declare -r PV_DOCKER_REGISTRY="polyverse"
declare -r PV_GIT_COMMIT="$(git rev-parse --verify HEAD)"
declare -r PV_NAME="tcp-echo-server"
declare -r PV_TARGETS="alpine centos trusty xenial bionic"
main() {
for PV_TARGET in ${PV_TARGETS}; do
publish ${PV_TARGET}
[ $? -ne 0 ] && return 1
done
return 0
}
publish() {
declare -r PV_TARGET="${1}"
# Don't publish when there are uncommitted changes.
if [ ! -z "$(git status -s -uno)" ]; then
echo "COMMIT IS DIRTY, aborting"
exit 1
fi
docker push "${PV_DOCKER_REGISTRY}/${PV_NAME}.${PV_TARGET}:latest"
[ $? -ne 0 ] && return 1
docker push "${PV_DOCKER_REGISTRY}/${PV_NAME}.${PV_TARGET}:${PV_GIT_COMMIT}"
[ $? -ne 0 ] && return 1
return 0
}
build() {
# Build the image
[ $? -ne 0 ] && return 1
return 0
}
main "$@"
exit $?
#!/bin/bash
set -e
declare -r PV_DOCKER_REGISTRY="polyverse"
declare -r PV_GIT_COMMIT="$(git rev-parse --verify HEAD)"
declare -r PV_NAME="readhook-node-echo-server"
main() {
publish
[ $? -ne 0 ] && return 1
return 0
}
main "$@"
exit $?