-
Notifications
You must be signed in to change notification settings - Fork 171
/
ci_env.sh
executable file
·62 lines (50 loc) · 1.91 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
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Script to populate some environment variables in various CI processes. Should be
# invoked by `ci_env.sh [script-name]`.
set -eo pipefail
# 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 [[ "${GITHUB_REF_NAME:-}" != "" ]]; then
branch="$GITHUB_REF_NAME"
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
export BUILD_TAGS="$HIGHEST_CHAIN_TAG"
# Only build with experimental tag for non-semver tagged releases
if [[ $generatedVersion != $definedVersion ]]; then
export BUILD_TAGS="${BUILD_TAGS},experimental"
fi
if [[ "$CI" == "true" ]]; then
echo "build-tags=${BUILD_TAGS}" >>"$GITHUB_OUTPUT"
fi
exec "$@"