Skip to content

Commit

Permalink
Fix to get version from git version
Browse files Browse the repository at this point in the history
  • Loading branch information
tnasu committed Nov 26, 2021
1 parent 9205eec commit 26c9b0c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
17 changes: 6 additions & 11 deletions DOCKER/build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
#!/usr/bin/env bash
set -e

# Get the tag from the version, or try to figure it out.
if [ -z "$TAG" ]; then
TAG=$(awk -F\" '/Version =/ { print $2; exit }' < ../version/version.go)
fi
if [ -z "$TAG" ]; then
echo "Please specify a tag."
exit 1
fi
# Get the git commit
VERSION=$(git describe --always)
echo "==> Building version $VERSION..."

TAG_NO_PATCH=${TAG%.*}
VERSION_NO_PATCH=${VERSION%.*}

read -p "==> Build 3 docker images with the following tags (latest, $TAG, $TAG_NO_PATCH)? y/n" -n 1 -r
read -p "==> Build 3 docker images with the following tags (latest, $VERSION, $VERSION_NO_PATCH)? y/n" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker build -t "ostracon/ostracon" -t "ostracon/ostracon:$TAG" -t "ostracon/ostracon:$TAG_NO_PATCH" .
docker build -t "ostracon/ostracon" -t "ostracon/ostracon:$VERSION" -t "ostracon/ostracon:$VERSION_NO_PATCH" -f ./Dockerfile ../
fi
19 changes: 7 additions & 12 deletions DOCKER/push.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
#!/usr/bin/env bash
set -e

# Get the tag from the version, or try to figure it out.
if [ -z "$TAG" ]; then
TAG=$(awk -F\" '/Version =/ { print $2; exit }' < ../version/version.go)
fi
if [ -z "$TAG" ]; then
echo "Please specify a tag."
exit 1
fi
# Get the git commit
VERSION=$(git describe --always)
echo "==> Building version $VERSION..."

TAG_NO_PATCH=${TAG%.*}
VERSION_NO_PATCH=${VERSION%.*}

read -p "==> Push 3 docker images with the following tags (latest, $TAG, $TAG_NO_PATCH)? y/n" -n 1 -r
read -p "==> Push 3 docker images with the following tags (latest, $VERSION, $VERSION_NO_PATCH)? y/n" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker push "ostracon/ostracon:latest"
docker push "ostracon/ostracon:$TAG"
docker push "ostracon/ostracon:$TAG_NO_PATCH"
docker push "ostracon/ostracon:$VERSION"
docker push "ostracon/ostracon:$VERSION_NO_PATCH"
fi
14 changes: 3 additions & 11 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ set -e
# WARN: non hermetic build (people must run this script inside docker to
# produce deterministic binaries).

# Get the version from the environment, or try to figure it out.
if [ -z $VERSION ]; then
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
fi
if [ -z "$VERSION" ]; then
echo "Please specify a version."
exit 1
fi
echo "==> Building version $VERSION..."

# Delete the old dir
echo "==> Removing old directory..."
rm -rf build/pkg
mkdir -p build/pkg

# Get the git commit
VERSION := "$(git describe --always)"
VERSION=$(git describe --always)
echo "==> Building version $VERSION..."

GIT_IMPORT="github.com/line/ostracon/version"

# Determine the arch/os combos we're building for
Expand Down

0 comments on commit 26c9b0c

Please sign in to comment.