mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
98c827449b
integration with circleci for various workflows
28 lines
784 B
Bash
Executable File
28 lines
784 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
ROOT="${BASH_SOURCE[0]%/*}"
|
|
|
|
SEMVER_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
|
|
RELEASE_BRANCH_REGEX="^release-v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
|
|
|
VERSION=""
|
|
if [ ! -z "${CIRCLE_TAG}" ]; then
|
|
if [[ "$CIRCLE_TAG" =~ $SEMVER_REGEX ]]; then
|
|
major=${BASH_REMATCH[1]}
|
|
minor=${BASH_REMATCH[2]}
|
|
VERSION="v$major.$minor"
|
|
fi
|
|
elif [ ! -z "$CIRCLE_BRANCH" ]; then
|
|
if [[ "$CIRCLE_BRANCH" =~ $RELEASE_BRANCH_REGEX ]]; then
|
|
major=${BASH_REMATCH[1]}
|
|
minor=${BASH_REMATCH[2]}
|
|
VERSION="v$major.$minor"
|
|
fi
|
|
fi
|
|
|
|
if [ -z "$VERSION" ]; then VERSION="$($ROOT/get-version.sh)"; fi
|
|
|
|
echo $VERSION |