mirror of
https://github.com/andwati/andwati.com.git
synced 2026-11-27 10:58:47 +00:00
feat(cms): implement Git publishing for content changes and add entrypoint script
- Added a Docker entrypoint script to manage content repository cloning and updates. - Updated server configuration to include public URL and proxy settings. - Enhanced content file utilities to return file paths for written entries. - Introduced GitPublisher class for handling Git operations and deployments. - Added tests for Git publishing functionality. - Updated Dockerfile and docker-compose for production setup. - Added new public PGP key and security.txt for contact information. - Created new About and Archive pages in the site. - Updated site configuration to include new navigation links.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
repository_root="${CONTENT_REPOSITORY_ROOT:-/content-repository}"
|
||||
repository="${CONTENT_GIT_REPOSITORY:-andwati/andwati.com}"
|
||||
branch="${CONTENT_GIT_BRANCH:-main}"
|
||||
|
||||
case "$repository" in
|
||||
*[!A-Za-z0-9._/-]* | /* | */ | *..*)
|
||||
echo "Invalid CONTENT_GIT_REPOSITORY: $repository" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p "$repository_root"
|
||||
|
||||
if [ ! -d "$repository_root/.git" ]; then
|
||||
if [ -n "$(find "$repository_root" -mindepth 1 -maxdepth 1 -print -quit)" ]; then
|
||||
echo "$repository_root is not empty and is not a Git checkout" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git clone \
|
||||
--branch "$branch" \
|
||||
--single-branch \
|
||||
"https://github.com/$repository.git" \
|
||||
"$repository_root"
|
||||
else
|
||||
git -C "$repository_root" fetch origin "$branch"
|
||||
git -C "$repository_root" checkout "$branch"
|
||||
|
||||
if [ -z "$(git -C "$repository_root" status --porcelain)" ]; then
|
||||
git -C "$repository_root" merge --ff-only "origin/$branch"
|
||||
else
|
||||
echo "Content checkout has unpublished changes; preserving them without pulling." >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
export CONTENT_REPOSITORY_ROOT="$repository_root"
|
||||
exec node node_modules/@strapi/strapi/bin/strapi.js start
|
||||
Reference in New Issue
Block a user