graphql-engine/scripts/get-version-circleci.sh
Shahidh K Muhammed 76ceb707f4
bundle console assets into server (close #516, close #521, close #2130) (#2192)
This PR builds console static assets into the server docker image at `/srv/console-assets`. When env var `HASURA_GRAPHQL_CONSOLE_ASSETS_DIR=/srv/console-assets` or flag `--console-assets-dir=/srv/console-assets` is set on the server, the files in this directory are served at `/console/assets/*`.

The console html template will have a variable called `cdnAssets: false` when this flag is set and it loads assets from server itself instead of CDN.

The assets are moved to a new bucket with a new naming scheme:

```
graphql-engine-cdn.hasura.io/console/assets/
   /common/{}
   /versioned/<version/{}
   /channel/<channel>/<version>/{}
```

Console served by CLI will still load assets from CDN - will fix that in the next release.
2019-05-16 13:15:29 +05:30

31 lines
839 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
VERSION="$(echo $VERSION | tr -cd '[[:alnum:]]._-')"
echo $VERSION