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 29, 2021
1 parent 8055b20 commit 3e79e20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
10 changes: 3 additions & 7 deletions DOCKER/build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/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
echo "Please specify a tag."
exit 1
fi

TAG_NO_PATCH=${TAG%.*}
Expand All @@ -16,5 +12,5 @@ read -p "==> Build 3 docker images with the following tags (latest, $TAG, $TAG_N
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:$TAG" -t "ostracon/ostracon:$TAG_NO_PATCH" -f ./Dockerfile ../
fi
8 changes: 2 additions & 6 deletions DOCKER/push.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/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
echo "Please specify a tag."
exit 1
fi

TAG_NO_PATCH=${TAG%.*}
Expand Down
12 changes: 3 additions & 9 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ 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
echo "Please specify a version."
exit 1
fi
echo "==> Building version $VERSION..."

Expand All @@ -19,8 +15,6 @@ echo "==> Removing old directory..."
rm -rf build/pkg
mkdir -p build/pkg

# Get the git commit
VERSION := "$(git describe --always)"
GIT_IMPORT="github.com/line/ostracon/version"

# Determine the arch/os combos we're building for
Expand Down Expand Up @@ -61,7 +55,7 @@ done
rm -rf ./build/dist
mkdir -p ./build/dist
for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do
FILENAME=$(basename "$FILENAME")
FILENAME=$(basename "$FILENAME")
cp "./build/pkg/${FILENAME}" "./build/dist/ostracon_${VERSION}_${FILENAME}"
done

Expand Down

0 comments on commit 3e79e20

Please sign in to comment.