-
Notifications
You must be signed in to change notification settings - Fork 39
/
releaseVersion.sh
executable file
·91 lines (78 loc) · 2.24 KB
/
releaseVersion.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
# set your token
#export GITHUB_TOKEN=...
USER="raystorm-place"
REPO="kibana-html-plugin"
BUILD_VERSION="1"
SKIP_INSTALL_DEPS="false"
# get the params
while getopts b:k:u:s option
do
case "${option}"
in
b) BUILD_VERSION=${OPTARG};;
k) KIBANA_VERSION=${OPTARG};;
u) USER=${OPTARG};;
s) SKIP_INSTALL_DEPS="true"
esac
done
# Check kibana version
if [ -z ${KIBANA_VERSION} ]; then
echo -e "Options: -k <Kibana version> (mandatory)"
echo -e " -b <Build increment> (default to 1)"
echo -e " -u <User to log in Github> (default to '$USER')"
echo -e " -s for skip dependencies install (default install deps)"
exit;
fi
TAG_NAME=${KIBANA_VERSION}-${BUILD_VERSION}
TAG_NAME_LATEST=${KIBANA_VERSION}-latest
# Install (or not) dependencies
echo
if [ "${SKIP_INSTALL_DEPS}" = "false" ]; then
echo "Install Kibana dependencies..."
echo
yarn kbn bootstrap
else
echo "Skip installing Kibana dependencies..."
fi
# Build packages
echo
echo "Build Kibana plugin package..."
echo
yarn build -b ${TAG_NAME} -k ${KIBANA_VERSION}
echo
echo "Create a package copy as latest..."
echo
echo "cp build/${REPO}-${TAG_NAME}.zip build/${REPO}-${TAG_NAME_LATEST}.zip"
cp build/${REPO}-${TAG_NAME}.zip build/${REPO}-${TAG_NAME_LATEST}.zip
# Create tag and release
echo
echo "Create Git tag for the new release"
git tag -m "update to version ${KIBANA_VERSION}" ${KIBANA_VERSION} && git push --tags
# create a formal release
echo
echo "Create the release"
github-release release \
--user ${USER} \
--repo ${REPO} \
--tag ${KIBANA_VERSION} \
--name "v${KIBANA_VERSION}" \
--description "Automatic plugin release for kibana v${KIBANA_VERSION}. " \
--pre-release
# upload the package file
echo
echo "Upload the corresponding package file"
github-release upload \
--user ${USER} \
--repo ${REPO} \
--tag ${KIBANA_VERSION} \
--name "${REPO}-${TAG_NAME}.zip" \
--file build/${REPO}-${TAG_NAME}.zip
# upload the alias "latest" package file
echo
echo "Upload the corresponding package file"
github-release upload \
--user ${USER} \
--repo ${REPO} \
--tag ${KIBANA_VERSION} \
--name "${REPO}-${TAG_NAME_LATEST}.zip" \
--file build/${REPO}-${TAG_NAME_LATEST}.zip