1
0
Fork 0
mirror of synced 2024-05-21 21:02:29 +12:00
budibase/scripts/pro/install.sh

39 lines
964 B
Bash
Raw Normal View History

#!/bin/bash
2022-04-22 21:16:09 +12:00
2022-04-22 22:49:15 +12:00
if [[ -z "${CI}" ]]; then
echo 'Cannot run install.sh unless in CI'
2022-04-22 08:55:16 +12:00
exit 0
fi
BRANCH=$1
BASE_BRANCH=$2
2022-04-22 08:55:16 +12:00
cd ../
echo "Cloning pro repo..."
2022-04-22 09:18:19 +12:00
git clone https://$PERSONAL_ACCESS_TOKEN@github.com/Budibase/budibase-pro.git
2022-04-22 08:55:16 +12:00
2022-04-22 22:45:45 +12: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 22:49:15 +12:00
if [[ -d "budibase-pro" ]]; then
2022-04-22 22:45:45 +12:00
cd budibase-pro
2022-04-22 08:55:16 +12:00
2022-10-05 02:50:21 +13:00
if [[ -z "${BRANCH}" ]]; then
2022-10-05 02:56:30 +13:00
echo Using GITHUB_REF_NAME: $GITHUB_REF_NAME
2022-10-05 02:50:21 +13:00
export BRANCH=$GITHUB_REF_NAME
fi
2022-04-22 22:45:45 +12: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 22:45:45 +12:00
# If neither branch exists continue with default branch 'develop'
git pull
echo "Initializing pro repo..."
yarn setup
fi