fix enrollment logic, add financial aid, fix class distribution
Tests / PHPUnit (push) Failing after 1m6s
Tests / PHPUnit (push) Failing after 1m6s
This commit is contained in:
+96
-22
@@ -1,4 +1,4 @@
|
||||
name: Deploy to Hosting Server
|
||||
name: Deploy to Shared Hosting
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -10,15 +10,19 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Manual deploy
|
||||
name: Shared hosting deploy
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||
DEPLOY_APP_PATH: ${{ secrets.DEPLOY_APP_PATH }}
|
||||
DEPLOY_PUBLIC_PATH: ${{ secrets.DEPLOY_PUBLIC_PATH }}
|
||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
DEPLOY_PHP_BIN: ${{ secrets.DEPLOY_PHP_BIN }}
|
||||
DEPLOY_INDEX_REQUIRE: ${{ secrets.DEPLOY_INDEX_REQUIRE }}
|
||||
GITEA_BASE_URL: ${{ secrets.GITEA_BASE_URL }}
|
||||
GITEA_PACKAGE_OWNER: ${{ secrets.GITEA_PACKAGE_OWNER }}
|
||||
GITEA_PACKAGE_USER: ${{ secrets.GITEAPACKAGEUSER }}
|
||||
@@ -45,10 +49,8 @@ jobs:
|
||||
run: bash scripts/build-deploy-artifact.sh
|
||||
|
||||
- name: Publish deployment package
|
||||
if: ${{ env.GITEA_PACKAGE_USER != '' && env.GITEA_PACKAGE_TOKEN != '' }}
|
||||
run: |
|
||||
test -n "${GITEA_PACKAGE_USER}"
|
||||
test -n "${GITEA_PACKAGE_TOKEN}"
|
||||
|
||||
BASE_URL="${GITEA_BASE_URL:-https://192.168.3.80}"
|
||||
PACKAGE_OWNER="${GITEA_PACKAGE_OWNER:-melabidi}"
|
||||
PACKAGE_NAME="alrahma_sunday_school"
|
||||
@@ -59,9 +61,7 @@ jobs:
|
||||
PACKAGE_URL="${BASE_URL}/api/packages/${PACKAGE_OWNER}/generic/${PACKAGE_NAME}/${VERSION}/${FILE_NAME}"
|
||||
|
||||
tar -czf "build/${FILE_NAME}" -C build/deploy .
|
||||
echo "Publishing package ${PACKAGE_NAME} ${VERSION} to ${BASE_URL}/-/packages"
|
||||
echo "Package owner: ${PACKAGE_OWNER}"
|
||||
echo "Package file: ${FILE_NAME}"
|
||||
echo "Publishing package ${PACKAGE_NAME} ${VERSION}"
|
||||
|
||||
curl --fail-with-body --insecure \
|
||||
--user "${GITEA_PACKAGE_USER}:${GITEA_PACKAGE_TOKEN}" \
|
||||
@@ -70,11 +70,33 @@ jobs:
|
||||
|
||||
echo "Package uploaded: ${PACKAGE_URL}"
|
||||
|
||||
- name: Resolve shared-hosting paths
|
||||
run: |
|
||||
APP_PATH="${DEPLOY_APP_PATH:-${DEPLOY_PATH}}"
|
||||
PUBLIC_PATH="${DEPLOY_PUBLIC_PATH}"
|
||||
|
||||
if [ -z "${APP_PATH}" ]; then
|
||||
echo "Set DEPLOY_APP_PATH (application directory next to public_html)."
|
||||
echo "Example: /home/u280815660/domains/home.alrahmaisgl.org/alrahma"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PUBLIC_PATH}" ]; then
|
||||
echo "Set DEPLOY_PUBLIC_PATH (shared-hosting document root)."
|
||||
echo "Example: /home/u280815660/domains/home.alrahmaisgl.org/public_html"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "APP_PATH=${APP_PATH}" >> "$GITHUB_ENV"
|
||||
echo "PUBLIC_PATH=${PUBLIC_PATH}" >> "$GITHUB_ENV"
|
||||
echo "SSH_PORT=${DEPLOY_PORT:-65002}" >> "$GITHUB_ENV"
|
||||
echo "PHP_BIN=${DEPLOY_PHP_BIN:-/opt/alt/php85/usr/bin/php}" >> "$GITHUB_ENV"
|
||||
echo "INDEX_REQUIRE=${DEPLOY_INDEX_REQUIRE:-../alrahma/app/Config/Paths.php}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Configure SSH
|
||||
run: |
|
||||
test -n "${DEPLOY_HOST}"
|
||||
test -n "${DEPLOY_USER}"
|
||||
test -n "${DEPLOY_PATH}"
|
||||
test -n "${DEPLOY_SSH_KEY}"
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
@@ -82,29 +104,81 @@ jobs:
|
||||
printf '%s\n' "${DEPLOY_SSH_KEY}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
|
||||
SSH_PORT="${DEPLOY_PORT:-22}"
|
||||
ssh-keyscan -p "${SSH_PORT}" "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
|
||||
{
|
||||
echo "Host shared-hosting"
|
||||
echo " HostName ${DEPLOY_HOST}"
|
||||
echo " User ${DEPLOY_USER}"
|
||||
echo " Port ${SSH_PORT}"
|
||||
echo " IdentityFile ~/.ssh/deploy_key"
|
||||
echo " IdentitiesOnly yes"
|
||||
echo " StrictHostKeyChecking accept-new"
|
||||
echo " ServerAliveInterval 30"
|
||||
} > ~/.ssh/config
|
||||
chmod 600 ~/.ssh/config
|
||||
|
||||
- name: Deploy files
|
||||
ssh-keyscan -p "${SSH_PORT}" "${DEPLOY_HOST}" >> ~/.ssh/known_hosts || true
|
||||
|
||||
- name: Prepare remote directories
|
||||
run: |
|
||||
SSH_PORT="${DEPLOY_PORT:-22}"
|
||||
|
||||
ssh -i ~/.ssh/deploy_key -p "${SSH_PORT}" "${DEPLOY_USER}@${DEPLOY_HOST}" \
|
||||
"mkdir -p '${DEPLOY_PATH}' '${DEPLOY_PATH}/writable/cache' '${DEPLOY_PATH}/writable/logs' '${DEPLOY_PATH}/writable/session' '${DEPLOY_PATH}/writable/uploads' '${DEPLOY_PATH}/writable/debugbar'"
|
||||
ssh shared-hosting "mkdir -p \
|
||||
'${APP_PATH}' \
|
||||
'${APP_PATH}/writable/cache' \
|
||||
'${APP_PATH}/writable/logs' \
|
||||
'${APP_PATH}/writable/session' \
|
||||
'${APP_PATH}/writable/uploads' \
|
||||
'${APP_PATH}/writable/debugbar' \
|
||||
'${APP_PATH}/writable/reports' \
|
||||
'${PUBLIC_PATH}'"
|
||||
|
||||
- name: Deploy application files
|
||||
run: |
|
||||
rsync -az --delete \
|
||||
-e "ssh -i ~/.ssh/deploy_key -p ${SSH_PORT}" \
|
||||
-e ssh \
|
||||
--exclude '.env' \
|
||||
--exclude 'writable/cache/***' \
|
||||
--exclude 'writable/logs/***' \
|
||||
--exclude 'writable/session/***' \
|
||||
--exclude 'writable/uploads/***' \
|
||||
--exclude 'writable/debugbar/***' \
|
||||
build/deploy/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/"
|
||||
--exclude 'writable/reports/***' \
|
||||
build/deploy/ "shared-hosting:${APP_PATH}/"
|
||||
|
||||
- name: Finalize deployment
|
||||
- name: Deploy public_html document root
|
||||
run: |
|
||||
SSH_PORT="${DEPLOY_PORT:-22}"
|
||||
rsync -az --delete \
|
||||
-e ssh \
|
||||
--exclude 'uploads/***' \
|
||||
--exclude 'cgi-bin/***' \
|
||||
--exclude '.well-known/***' \
|
||||
--exclude 'error_log' \
|
||||
--exclude 'default.php' \
|
||||
build/deploy/public/ "shared-hosting:${PUBLIC_PATH}/"
|
||||
|
||||
ssh -i ~/.ssh/deploy_key -p "${SSH_PORT}" "${DEPLOY_USER}@${DEPLOY_HOST}" \
|
||||
"cd '${DEPLOY_PATH}' && php spark cache:clear || true"
|
||||
- name: Finalize shared-hosting release
|
||||
run: |
|
||||
ssh shared-hosting "APP_PATH=$(printf '%q' "${APP_PATH}") PUBLIC_PATH=$(printf '%q' "${PUBLIC_PATH}") INDEX_REQUIRE=$(printf '%q' "${INDEX_REQUIRE}") PHP_BIN=$(printf '%q' "${PHP_BIN}") bash -s" <<'REMOTE'
|
||||
set -euo pipefail
|
||||
|
||||
test -f "${PUBLIC_PATH}/index.php"
|
||||
test -d "${APP_PATH}/app"
|
||||
test -d "${APP_PATH}/vendor"
|
||||
|
||||
grep -q "require FCPATH . '" "${PUBLIC_PATH}/index.php"
|
||||
sed -i "s|require FCPATH . '../[^']*app/Config/Paths.php';|require FCPATH . '${INDEX_REQUIRE}';|" "${PUBLIC_PATH}/index.php"
|
||||
grep -F "require FCPATH . '${INDEX_REQUIRE}';" "${PUBLIC_PATH}/index.php"
|
||||
|
||||
chmod 644 "${PUBLIC_PATH}/index.php" "${PUBLIC_PATH}/.htaccess" || true
|
||||
find "${PUBLIC_PATH}" -type d -exec chmod 755 {} +
|
||||
find "${APP_PATH}/writable" -type d -exec chmod 775 {} + || true
|
||||
find "${APP_PATH}/writable" -type f -exec chmod 664 {} + || true
|
||||
|
||||
if [ -x "${PHP_BIN}" ]; then
|
||||
(cd "${APP_PATH}" && "${PHP_BIN}" spark cache:clear) || true
|
||||
else
|
||||
(cd "${APP_PATH}" && php spark cache:clear) || true
|
||||
fi
|
||||
|
||||
echo "Deployed app to ${APP_PATH}"
|
||||
echo "Deployed document root to ${PUBLIC_PATH}"
|
||||
echo "index.php requires ${INDEX_REQUIRE}"
|
||||
REMOTE
|
||||
|
||||
Reference in New Issue
Block a user