Skip to content

Commit 1079ce3

Browse files
committed
- update app.setup.sh to allow testing against different branches of WPGraphQL in Github
1 parent 829ca4e commit 1079ce3

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

docker/app.setup.sh

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ACF_VERSION=${ACF_VERSION-"latest"}
1010
ACF_PRO=${ACF_PRO-false}
1111
WPGRAPHQL_CONTENT_BLOCKS=${WPGRAPHQL_CONTENT_BLOCKS-false}
1212
WPGRAPHQL_CONTENT_BLOCKS_VERSION=${WPGRAPHQL_CONTENT_BLOCKS_VERSION-"latest"}
13+
WPGRAPHQL_GIT_REPO=${WPGRAPHQL_GIT_REPO-}
14+
WPGRAPHQL_GIT_BRANCH=${WPGRAPHQL_GIT_BRANCH-"develop"}
1315

1416
#// fallback to hello.php as a hack. dont love this, but we have to pass a slug.
1517
export WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_SLUG=${WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_SLUG-'hello.php'}
@@ -36,15 +38,31 @@ apt-get -y update
3638
apt-get -y install jq
3739

3840
if [ ! -f "${PLUGINS_DIR}/wp-graphql/wp-graphql.php" ]; then
39-
# WPGRAPHQL_VERSION in format like v1.2.3 or latest
40-
echo "Install wp-graphql version (${WPGRAPHQL_VERSION})"
41-
if [[ -z ${WPGRAPHQL_VERSION} || "${WPGRAPHQL_VERSION}" == "latest" ]]; then
42-
echo "Installing latest WPGraphQL from WordPress.org"
43-
wp plugin install wp-graphql --activate --allow-root
44-
else
45-
echo "Installing WPGraphQL from Github"
46-
wp plugin install "https://downloads.wordpress.org/plugin/wp-graphql.${WPGRAPHQL_VERSION-1.4.3}.zip" --allow-root --activate
47-
fi
41+
42+
43+
# if WPGRAPHQL_GIT_REPO is set, we'll install from the repo
44+
if [[ -n ${WPGRAPHQL_GIT_REPO} ]]; then
45+
echo "Installing WPGraphQL from GitHub repo ${WPGRAPHQL_GIT_REPO}"
46+
# Clone the repository
47+
git clone -b ${WPGRAPHQL_GIT_BRANCH} ${WPGRAPHQL_GIT_REPO} "${PLUGINS_DIR}/wp-graphql"
48+
# Navigate to the plugin directory
49+
cd "${PLUGINS_DIR}/wp-graphql"
50+
# Install dependencies with Composer
51+
composer install --no-dev
52+
# Optionally activate the plugin using wp-cli
53+
wp plugin activate wp-graphql --allow-root
54+
else
55+
# WPGRAPHQL_VERSION in format like v1.2.3 or latest
56+
echo "Install wp-graphql version (${WPGRAPHQL_VERSION})"
57+
if [[ -z ${WPGRAPHQL_VERSION} || "${WPGRAPHQL_VERSION}" == "latest" ]]; then
58+
echo "Installing latest WPGraphQL from WordPress.org"
59+
wp plugin install wp-graphql --activate --allow-root
60+
else
61+
echo "Installing WPGraphQL from Github"
62+
wp plugin install "https://downloads.wordpress.org/plugin/wp-graphql.${WPGRAPHQL_VERSION-1.4.3}.zip" --allow-root --activate
63+
fi
64+
fi
65+
4866
fi
4967

5068
# Activate the plugin

0 commit comments

Comments
 (0)