@@ -37,6 +37,9 @@ jobs:
|
||||
- name: Install production dependencies
|
||||
run: composer install --no-dev --no-interaction --prefer-dist --no-progress --optimize-autoloader
|
||||
|
||||
- name: Create deployment artifact
|
||||
run: bash scripts/build-deploy-artifact.sh
|
||||
|
||||
- name: Configure SSH
|
||||
run: |
|
||||
test -n "${DEPLOY_HOST}"
|
||||
@@ -61,19 +64,13 @@ jobs:
|
||||
|
||||
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}/"
|
||||
build/deploy/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/"
|
||||
|
||||
- name: Finalize deployment
|
||||
run: |
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Deployment Files
|
||||
|
||||
The hosting deployment is built by `scripts/build-deploy-artifact.sh` into `build/deploy/`.
|
||||
|
||||
Included:
|
||||
|
||||
- `app/`
|
||||
- `bootstrap/`
|
||||
- `public/`
|
||||
- `routes/`
|
||||
- `vendor/`
|
||||
- `composer.json`
|
||||
- `composer.lock`
|
||||
- `spark`
|
||||
- `preload.php`
|
||||
- `writable/.htaccess`
|
||||
- `writable/index.html`
|
||||
- `writable/.gitkeep`
|
||||
- `writable/*/.gitkeep`
|
||||
- `writable/tcpdf_fonts/`
|
||||
|
||||
Excluded:
|
||||
|
||||
- `.git/`
|
||||
- `.gitea/`
|
||||
- `.env` and local env backups
|
||||
- `tests/`
|
||||
- `Database_Dump/`
|
||||
- `build/` except the generated deploy artifact during CI
|
||||
- documentation/planning files
|
||||
- local scripts that are not needed at runtime
|
||||
- runtime cache, logs, sessions, uploads, and generated reports
|
||||
|
||||
The server keeps its own `.env` and runtime `writable/` contents. The deploy job syncs from `build/deploy/` and excludes mutable writable subdirectories so production data is not overwritten.
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
DEPLOY_DIR="${1:-"${ROOT_DIR}/build/deploy"}"
|
||||
|
||||
rm -rf "${DEPLOY_DIR}"
|
||||
mkdir -p "${DEPLOY_DIR}"
|
||||
|
||||
copy_path() {
|
||||
local source="$1"
|
||||
|
||||
if [ -e "${ROOT_DIR}/${source}" ]; then
|
||||
mkdir -p "${DEPLOY_DIR}/$(dirname "${source}")"
|
||||
cp -a "${ROOT_DIR}/${source}" "${DEPLOY_DIR}/${source}"
|
||||
fi
|
||||
}
|
||||
|
||||
# CodeIgniter application/runtime entry points.
|
||||
copy_path app
|
||||
copy_path bootstrap
|
||||
copy_path public
|
||||
copy_path routes
|
||||
copy_path vendor
|
||||
copy_path composer.json
|
||||
copy_path composer.lock
|
||||
copy_path spark
|
||||
copy_path preload.php
|
||||
|
||||
# Writable should exist on the server, but deploy only safe skeleton files.
|
||||
mkdir -p \
|
||||
"${DEPLOY_DIR}/writable/cache" \
|
||||
"${DEPLOY_DIR}/writable/debugbar" \
|
||||
"${DEPLOY_DIR}/writable/logs" \
|
||||
"${DEPLOY_DIR}/writable/reports" \
|
||||
"${DEPLOY_DIR}/writable/session" \
|
||||
"${DEPLOY_DIR}/writable/uploads"
|
||||
|
||||
copy_path writable/.htaccess
|
||||
copy_path writable/index.html
|
||||
copy_path writable/.gitkeep
|
||||
copy_path writable/cache/.gitkeep
|
||||
copy_path writable/debugbar/.gitkeep
|
||||
copy_path writable/logs/.gitkeep
|
||||
copy_path writable/session/.gitkeep
|
||||
copy_path writable/uploads/.gitkeep
|
||||
copy_path writable/tcpdf_fonts
|
||||
|
||||
find "${DEPLOY_DIR}" -name '.DS_Store' -delete
|
||||
Reference in New Issue
Block a user