add deploy
Tests / PHPUnit (push) Successful in 1m16s

This commit is contained in:
root
2026-07-16 00:34:19 -04:00
parent 7c341ca624
commit df4e2cf994
2 changed files with 95 additions and 3 deletions
+85
View File
@@ -0,0 +1,85 @@
name: Deploy to Hosting Server
on:
workflow_dispatch:
inputs:
confirm:
description: 'Type DEPLOY to deploy this branch to the hosting server'
required: true
default: ''
jobs:
deploy:
name: Manual deploy
runs-on: ubuntu-latest
if: ${{ github.event.inputs.confirm == 'DEPLOY' }}
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: dom, gd, intl, mbstring, mysqli, zip
coverage: none
- name: Validate Composer config
run: composer validate --no-check-publish --strict
- name: Install production dependencies
run: composer install --no-dev --no-interaction --prefer-dist --no-progress --optimize-autoloader
- name: Configure SSH
run: |
test -n "${DEPLOY_HOST}"
test -n "${DEPLOY_USER}"
test -n "${DEPLOY_PATH}"
test -n "${DEPLOY_SSH_KEY}"
mkdir -p ~/.ssh
chmod 700 ~/.ssh
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
- name: Deploy files
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'"
rsync -az --delete \
-e "ssh -i ~/.ssh/deploy_key -p ${SSH_PORT}" \
--exclude '.git/' \
--exclude '.gitea/' \
--exclude '.env' \
--exclude 'env' \
--exclude 'env.*' \
--exclude 'writable/cache/***' \
--exclude 'writable/logs/***' \
--exclude 'writable/session/***' \
--exclude 'writable/uploads/***' \
--exclude 'writable/debugbar/***' \
--exclude 'tests/' \
--exclude 'phpunit.xml*' \
./ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/"
- name: Finalize deployment
run: |
SSH_PORT="${DEPLOY_PORT:-22}"
ssh -i ~/.ssh/deploy_key -p "${SSH_PORT}" "${DEPLOY_USER}@${DEPLOY_HOST}" \
"cd '${DEPLOY_PATH}' && php spark cache:clear || true"
+10 -3
View File
@@ -156,13 +156,20 @@ $chartLabels = array_map($formatDateKey, $dateOrder);
<script>
document.addEventListener('DOMContentLoaded', function() {
const ctx = document.getElementById('lateChart').getContext('2d');
const lateChart = document.getElementById('lateChart');
if (!lateChart || typeof Chart === 'undefined') {
return;
}
// PHP to JS data conversion
const labels = <?= json_encode($chartLabels) ?>;
const counts = <?= json_encode($chartData) ?>;
new Chart(ctx, {
if (!labels.length || !counts.length) {
return;
}
new Chart(lateChart.getContext('2d'), {
type: 'bar',
data: {
labels: labels,