2018-01-30 04:45:53 -06:00
|
|
|
#!/bin/bash
|
2018-04-10 03:13:53 -05:00
|
|
|
# Builds develop, develop-* and master branches
|
2018-01-30 04:45:53 -06:00
|
|
|
|
2018-04-10 03:58:31 -05:00
|
|
|
echo "▶️ $0 $*"
|
|
|
|
|
2019-02-01 02:58:07 -06:00
|
|
|
if [ -n "${GITHUB_OAUTH_CLIENT_ID}" ] && [ -n "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then
|
2018-08-28 11:21:08 -05:00
|
|
|
echo "🗝 Performing authenticated Github API calls."
|
|
|
|
GITHUB_OAUTH_PARAMS="client_id=${GITHUB_OAUTH_CLIENT_ID}&client_secret=${GITHUB_OAUTH_CLIENT_SECRET}"
|
|
|
|
else
|
|
|
|
echo "🕶 Performing unauthenticated Github API calls. This might result in lower Github rate limits!"
|
|
|
|
GITHUB_OAUTH_PARAMS=""
|
|
|
|
fi
|
|
|
|
|
2019-07-02 14:32:58 -05:00
|
|
|
ORIGINAL_GITHUB_REPO="${SRC_ORG-netbox-community}/${SRC_REPO-netbox}"
|
2018-01-30 04:45:53 -06:00
|
|
|
GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}"
|
2018-08-28 11:21:08 -05:00
|
|
|
URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/branches?${GITHUB_OAUTH_PARAMS}"
|
2018-01-30 04:45:53 -06:00
|
|
|
|
2018-03-05 07:29:24 -06:00
|
|
|
CURL="curl -sS"
|
2018-01-30 04:45:53 -06:00
|
|
|
|
2018-04-10 03:13:53 -05:00
|
|
|
BRANCHES=$($CURL "${URL_RELEASES}" | jq -r 'map(.name) | .[] | scan("^[^v].+") | match("^(master|develop).*") | .string')
|
2018-01-30 04:45:53 -06:00
|
|
|
|
2018-04-06 04:15:39 -05:00
|
|
|
ERROR=0
|
|
|
|
|
2018-01-30 04:45:53 -06:00
|
|
|
for BRANCH in $BRANCHES; do
|
2018-03-05 07:29:24 -06:00
|
|
|
# shellcheck disable=SC2068
|
2018-04-06 04:15:39 -05:00
|
|
|
./build.sh "${BRANCH}" $@ || ERROR=1
|
2018-01-30 04:45:53 -06:00
|
|
|
done
|
2018-04-06 04:15:39 -05:00
|
|
|
exit $ERROR
|