Skip to content

Commit

Permalink
fix(VERSION): delete VERSION file from repo (#94)
Browse files Browse the repository at this point in the history
VERSION file will be generated while building and it will be deleted 
once the build is successful. So that we will decouple dependency
with the VERSION and forked branch also will be able to generate
build with custom tags

Signed-off-by: mittachaitu <[email protected]>
  • Loading branch information
sai chaithanya authored Jun 22, 2020
1 parent de99c47 commit 68bb336
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

30 changes: 29 additions & 1 deletion buildscripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
# This script builds the application from source for multiple platforms.
set -e

VERSION_FILE_PATH="$GOPATH/src/github.com/openebs/cstor-csi/VERSION"

on_exit() {
## Delete VERSION file
echo "Deleteing VERSION File($VERSION_FILE_PATH) that got generated during build time"
rm -f "$VERSION_FILE_PATH"
}

trap 'on_exit' EXIT

# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
Expand All @@ -39,7 +49,25 @@ if [[ -n "$TRAVIS_TAG" ]] && [[ $TRAVIS_TAG != *"RC"* ]]; then
fi

# Get the version details
VERSION="$(cat $GOPATH/src/github.com/openebs/cstor-csi/VERSION)"
# VERSION="$(cat $GOPATH/src/github.com/openebs/cstor-csi/VERSION)"

## Populate the version based on release tag
## If travis tag is set then assign it as VERSION and
## if travis tag is empty then mark version as ci
if [ -n "$TRAVIS_TAG" ]; then
# Trim the `v` from the TRAVIS_TAG if it exists
# Example: v1.10.0 maps to 1.10.0
# Example: 1.10.0 maps to 1.10.0
# Example: v1.10.0-custom maps to 1.10.0-custom
VERSION="${TRAVIS_TAG#v}"
else
VERSION="dev"
fi

echo "Building for VERSION ${VERSION}"
## Below line will help to get current version for various binaries
echo "${VERSION}" > "$VERSION_FILE_PATH"


# Determine the arch/os combos we're building for
UNAME=$(uname)
Expand Down

0 comments on commit 68bb336

Please sign in to comment.