budibase/scripts/pro/install.sh

34 lines
842 B
Bash
Raw Normal View History

2022-04-22 11:16:09 +02:00
#!/bin/bash
2022-04-22 12:49:15 +02:00
if [[ -z "${CI}" ]]; then
2022-04-21 22:55:16 +02:00
echo 'Cannot run insall.sh unless in CI'
exit 0
fi
BRANCH=$1
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-04-22 12:45:45 +02:00
# Try to checkout the matching pro branch
git checkout $BRANCH
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