-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathpackage-native-zip.sh
executable file
·142 lines (113 loc) · 4.39 KB
/
package-native-zip.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
set -e
CURRENT_DIR=`pwd`
PACKAGE_VERSION_NUMBER="$1"
if [ -z "$PACKAGE_VERSION_NUMBER" ]; then
echo "ERROR: Package version number must be specified"
exit 1
fi
UNAME_VALUE=`uname`
if [ "$UNAME_VALUE" = "Darwin" ]; then
PACKAGE_OS_NAME="Mac_OS_X-x86_64"
if ! brew -v >/dev/null 2>&1; then
echo "ERROR: brew must be installed in order to package "
exit 1
fi
elif [ "$UNAME_VALUE" = "Linux" ]; then
PACKAGE_OS_NAME="Linux-amd64"
else
echo "ERROR: Unable to build package for $UNAME_VALUE"
exit 1
fi
PACKAGE_NAME="conductr-cli-$PACKAGE_VERSION_NUMBER-$PACKAGE_OS_NAME.zip"
echo ""
echo "Building $PACKAGE_NAME"
echo ""
rm -rf dist/*
echo "------------------------------------------------"
echo "Creating single executable for 'conduct' command"
echo "------------------------------------------------"
echo ""
pyinstaller --onefile conduct.spec
echo "------------------------------------------------"
echo "Creating single executable for 'sandbox' command"
echo "------------------------------------------------"
echo ""
pyinstaller --onefile sandbox.spec
echo "------------------------------------------------"
echo "Creating single executable for 'shazar' command"
echo "------------------------------------------------"
echo ""
pyinstaller --onefile shazar.spec
echo "------------------------------------------------"
echo "Creating single executable for 'bndl' command"
echo "------------------------------------------------"
echo ""
pyinstaller --onefile bndl.spec
echo "------------------------------------------------"
echo "Validating version for 'conduct' command"
echo "------------------------------------------------"
echo ""
# Do not use `head -n 1` to trim the first line of the output as this will result in broken pipe error in Linux.
CONDUCT_VERSION=$(dist/conduct version)
CONDUCT_VERSION=$(echo $CONDUCT_VERSION | awk '{print $1}')
if [ "$CONDUCT_VERSION" != "$PACKAGE_VERSION_NUMBER" ]; then
echo "ERROR: Mismatched version number for 'conduct' command"
echo "ERROR: 'conduct' command version: $CONDUCT_VERSION"
echo "ERROR: Package version: $PACKAGE_VERSION_NUMBER"
exit 1
fi
echo "------------------------------------------------"
echo "Validating version for 'sandbox' command"
echo "------------------------------------------------"
echo ""
# Do not use `head -n 1` to trim the first line of the output as this will result in broken pipe error in Linux.
SANDBOX_VERSION=$(dist/sandbox version)
SANDBOX_VERSION=$(echo $SANDBOX_VERSION | awk '{print $1}')
if [ "$SANDBOX_VERSION" != "$PACKAGE_VERSION_NUMBER" ]; then
echo "ERROR: Mismatched version number for 'sandbox' command"
echo "ERROR: 'sandbox' command version: $SANDBOX_VERSION"
echo "ERROR: Package version: $PACKAGE_VERSION_NUMBER"
exit 1
fi
echo "------------------------------------------------"
echo "Checking 'sandbox' and 'conduct' command is working as expected"
echo "------------------------------------------------"
echo ""
dist/sandbox run 2.0.5 -f visualization
echo "Checking Visualizer"
curl http://192.168.10.1:9008/services/visualizer
echo ""
conduct info
dist/sandbox stop
echo "------------------------------------------------"
echo "Checking 'shazar' command is working as expected"
echo "------------------------------------------------"
echo ""
dist/shazar -h
echo "------------------------------------------------"
echo "Checking 'bndl' command is working as expected"
echo "------------------------------------------------"
echo ""
dist/bndl -h
echo "------------------------------------------------"
echo "Building zip archive for $PACKAGE_NAME"
echo "------------------------------------------------"
echo ""
zip -j dist/$PACKAGE_NAME dist/conduct dist/sandbox dist/shazar dist/bndl
if [ "$UNAME_VALUE" = "Darwin" ]; then
echo "------------------------------------------------"
echo "Creating the Homebrew package pull request"
echo "------------------------------------------------"
echo ""
brew tap typesafehub/conductr
brew bump-formula-pr \
--url=https://bintray.com/lightbend/generic/download_file?file_path=${PACKAGE_NAME} \
--sha256=$(shasum -a256 dist/$PACKAGE_NAME | cut -d ' ' -f 1) \
--version=${PACKAGE_VERSION_NUMBER} \
conductr-cli
fi
echo "------------------------------------------------"
echo "Success"
echo "------------------------------------------------"
echo "Created archive in dist/$PACKAGE_NAME"