2022-11-14 14:29:46 +01:00
|
|
|
#!/bin/bash
|
2022-04-22 11:16:09 +02:00
|
|
|
|
2022-04-22 12:49:15 +02:00
|
|
|
if [[ -z "${CI}" ]]; then
|
2022-11-14 14:29:46 +01:00
|
|
|
echo 'Cannot run install.sh unless in CI'
|
2022-04-21 22:55:16 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
BRANCH=$1
|
2022-04-21 23:12:57 +02:00
|
|
|
BASE_BRANCH=$2
|
2022-04-21 22:55:16 +02:00
|
|
|
|
|
|
|
cd ../
|
|
|
|
echo "Cloning pro repo..."
|
2022-04-21 23:18:19 +02:00
|
|
|
git clone https://$PERSONAL_ACCESS_TOKEN@github.com/Budibase/budibase-pro.git
|
2022-04-21 22:55:16 +02:00
|
|
|
|
2022-04-22 12:45:45 +02:00
|
|
|
# Community forks won't be able to clone the pro repo as they can't access secrets
|
|
|
|
# Skip the rest of the installation and rely on npm version instead
|
|
|
|
# This should be ok as forks will not rely on pro changes
|
2022-04-22 12:49:15 +02:00
|
|
|
if [[ -d "budibase-pro" ]]; then
|
2022-04-22 12:45:45 +02:00
|
|
|
cd budibase-pro
|
2022-04-21 22:55:16 +02:00
|
|
|
|
2022-10-04 15:50:21 +02:00
|
|
|
if [[ -z "${BRANCH}" ]]; then
|
2022-10-04 15:56:30 +02:00
|
|
|
echo Using GITHUB_REF_NAME: $GITHUB_REF_NAME
|
2022-10-04 15:50:21 +02:00
|
|
|
export BRANCH=$GITHUB_REF_NAME
|
|
|
|
fi
|
|
|
|
|
2022-04-22 12:45:45 +02:00
|
|
|
# Try to checkout the matching pro branch
|
|
|
|
git checkout $BRANCH
|
2022-04-26 18:55:33 +02:00
|
|
|
|
|
|
|
if [[ $? == "1" ]] && [[ $BASE_BRANCH ]]; then
|
|
|
|
# There is no matching branch, try to match the base branch
|
|
|
|
git checkout $BASE_BRANCH
|
|
|
|
fi
|
|
|
|
|
2022-04-22 12:45:45 +02:00
|
|
|
# If neither branch exists continue with default branch 'develop'
|
|
|
|
git pull
|
|
|
|
|
|
|
|
echo "Initializing pro repo..."
|
|
|
|
yarn setup
|
|
|
|
fi
|