forked from livepeer/go-livepeer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_env.sh
executable file
·51 lines (42 loc) · 1.62 KB
/
ci_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Script to populate some environment variables in various CI processes. Should be
# invoked by `ci_env.sh [script-name]`.
set -e
# Populate necessary Windows build path stuff
if [[ $(uname) == *"MSYS"* ]]; then
export PATH="/usr/bin:/mingw64/bin:$PATH"
export HOME="/build"
export C_INCLUDE_PATH="$HOME/compiled/lib:/mingw64/lib:/mingw64/lib:${C_INCLUDE_PATH:-}"
mkdir -p $HOME
export PATH="$HOME/compiled/bin":$PATH
export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:$HOME/compiled/lib/pkgconfig"
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
fi
# If we want to build with branch --> network support for any other networks, add them here!
NETWORK_BRANCHES="dev rinkeby"
branch=""
if [[ "${TRAVIS_BRANCH:-}" != "" ]]; then
branch="$TRAVIS_BRANCH"
elif [[ "${GHA_REF:-}" != "" ]]; then
branch="$(echo $GHA_REF | sed 's/refs\/heads\///')"
fi
# By default we build with mainnet support
# If we are on the dev branch then we do not build with Rinkeby or mainnet support
# If we are on the rinkeby branch then we build with Rinkeby support, but not mainnet support
export HIGHEST_CHAIN_TAG=mainnet
for networkBranch in $NETWORK_BRANCHES; do
if [[ $branch == "$networkBranch" ]]; then
export HIGHEST_CHAIN_TAG=$networkBranch
fi
done
# Allow non-tagged mainnet builds, but tagged releases should have mainnet support
generatedVersion=$(./print_version.sh)
definedVersion=$(cat VERSION)
if [[ $HIGHEST_CHAIN_TAG != "mainnet" ]]; then
if [[ $generatedVersion == $definedVersion ]]; then
echo "disallowing semver tag release $generatedVersion on branch '$branch', should be 'mainnet'"
exit 1
fi
fi
exec "$@"