Skip to content

Commit

Permalink
OXDEV-7248 Update GHA to work with shop 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hkreuter committed Feb 12, 2025
1 parent 5fa21ca commit 9f30088
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/oxid-esales/graphql-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
install:
cache:
prepared_shop: false
method: 'script'
script: 'source/.github/oxid-esales/install.sh'
git:
repository: '{{ $repo }}'
ref: &ref '{{ .Github.RefName }}'
Expand Down
81 changes: 81 additions & 0 deletions .github/oxid-esales/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash
# shellcheck disable=SC2154
# Lower case environment variables are passed from the workflow and used here
# We use a validation loop in init to ensure, they're set
# shellcheck disable=SC2086
# We want install_container_options to count as multiple arguments
set -e

function error() {
echo -e "\033[0;31m${1}\033[0m"
exit 1
}

function init() {
for VAR in install_container_method install_container_options install_container_name \
install_config_idebug install_is_enterprise; do
echo -n "Checking, if $VAR is set ..."
if [ -z ${VAR+x} ]; then
error "Variable '${VAR}' not set"
fi
echo "OK, ${VAR}='${!VAR}'"
done
echo -n "Locating oe-console ... "
cd source || exit 1
if [ -f 'bin/oe-console' ]; then
OE_CONSOLE='bin/oe-console'
else
if [ -f 'vendor/bin/oe-console' ]; then
OE_CONSOLE='vendor/bin/oe-console'
else
error "Can't find oe-console in bin or vendor/bin!"
fi
fi
echo "OK, using '${OE_CONSOLE}'"
if [ -z "${OXID_BUILD_DIRECTORY}" ]; then
echo "OXID_BUILD_DIRECTORY is not set, setting it to /var/www/var/cache/"
export OXID_BUILD_DIRECTORY="/var/www/var/cache/"
else
echo "OXID_BUILD_DIRECTORY is set to '${OXID_BUILD_DIRECTORY}'"
fi
if [ ! -d "${OXID_BUILD_DIRECTORY/\/var\/www/source}" ]; then
echo "Creating '${OXID_BUILD_DIRECTORY}'"

docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
mkdir -p "${OXID_BUILD_DIRECTORY}"

echo "done with build directory"
fi
}

init

cp vendor/oxid-esales/oxideshop-ce/.env.dist .env
cat .env


# Run Install Shop
docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
${OE_CONSOLE} oe:database:reset --force

# Activate iDebug
if [ "${install_config_idebug}" == 'true' ]; then
export OXID_DEBUG_MODE="true"
fi

# Activate theme
docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
${OE_CONSOLE} oe:theme:activate apex

# Output PHP error log
if [ -s data/php/logs/error_log.txt ]; then
echo -e "\033[0;35mPHP error log\033[0m"
cat data/php/logs/error_log.txt
fi
exit 0

0 comments on commit 9f30088

Please sign in to comment.