forked from eclipse-bluechi/bluechi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.sh
executable file
·43 lines (37 loc) · 1.08 KB
/
version.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
#!/bin/bash -e
#
# Copyright Contributors to the Eclipse BlueChi project
#
# SPDX-License-Identifier: LGPL-2.1-or-later
# Current version of BlueChi
VERSION=0.10.0
# Specify if build is a official release or a snapshot build
IS_RELEASE="0"
# Used for official releases. Increment if necessary
RELEASE="1"
# Used to cache generated snapshot release for further usage
RELEASE_FILE=$(dirname "$(readlink -f "$0")")/RELEASE
function short(){
echo ${VERSION}
}
function long(){
echo "$(short)-$(release)"
}
function release(){
# Package release
if [ -f "${RELEASE_FILE}" ]; then
# Read existing release from release file to keep the same release during the whole build
RELEASE="$(cat ${RELEASE_FILE})"
else
# Release file doesn't exist, populate it with a release
if [ $IS_RELEASE == "0" ]; then
RELEASE="0.$(date +%04Y%02m%02d%02H%02M).git$(git rev-parse --short ${GITHUB_SHA:-HEAD})"
fi
echo ${RELEASE} > ${RELEASE_FILE}
fi
echo $RELEASE
}
function clean(){
rm -f "${RELEASE_FILE}"
}
[ -z $1 ] && short || $1