-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-release.sh
executable file
·39 lines (28 loc) · 1.12 KB
/
create-release.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
#!/bin/bash
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function latest_version {
if ls "$THIS_SCRIPT_DIR/"releases/elasticapm/elasticapm-*.yml >/dev/null 2>&1; then
grep -r '^version: ' "$THIS_SCRIPT_DIR/"releases/elasticapm/elasticapm-*.yml | awk -F': ' '{print $NF}' | tail -n 1
return 0
fi
echo "0.0.0"
}
function bump_minor_version {
local version=$1
local major_version
local minor_version
major_version="$(echo "$version" | awk -F '.' '{print $1}')"
minor_version="$(echo "$version" | awk -F '.' '{print $2}')"
echo "$major_version.$(( minor_version + 1 )).0"
}
function main {
local elasticapm_bosh_release_version
local release_dir
local tarball
elasticapm_bosh_release_version="$(bump_minor_version "$(latest_version)")"
release_dir="$THIS_SCRIPT_DIR/releases"
tarball="elasticapm-boshrelease-$elasticapm_bosh_release_version.tgz"
"$THIS_SCRIPT_DIR"/add-blobs.sh
bosh create-release --name=elasticapm --force --version="$elasticapm_bosh_release_version" --final --tarball="$release_dir/$tarball"
}
main