Files
Posidonia/scripts/build.sh
T
itziarZG 950af21f7b feat(build): introduce scripts/build.sh for deploy-time envsubst
Replaces literal email and Umami website ID in the HTML files with
[EMAIL_ADDRESS] and [UMAMI_WEBSITE_ID] placeholders. Coolify runs
scripts/build.sh as the build step before serving, substituting the
placeholders with values from service env vars (CONTACT_EMAIL and
UMAMI_WEBSITE_ID). The repo no longer contains the real email or
website id.

Also mirrors recent text refinements from the Catalan 'Per què ho
faig' section into the Spanish 'Por qué lo hago' section. Adds public/
to .gitignore and refreshes README + CHANGELOG.
2026-07-30 15:28:28 +02:00

33 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build script for Coolify: substitute [EMAIL_ADDRESS] and [UMAMI_WEBSITE_ID]
# placeholders using environment variables, then output to ./public/
#
# Required env vars:
# CONTACT_EMAIL — the actual email address
# UMAMI_WEBSITE_ID — the umami website UUID
set -euo pipefail
: "${CONTACT_EMAIL:?Need CONTACT_EMAIL env var}"
: "${UMAMI_WEBSITE_ID:?Need UMAMI_WEBSITE_ID env var}"
mkdir -p public
# Substitute placeholders in both language files
sed \
-e "s|\[EMAIL_ADDRESS\]|${CONTACT_EMAIL}|g" \
-e "s|\[UMAMI_WEBSITE_ID\]|${UMAMI_WEBSITE_ID}|g" \
index.html > public/index.html
mkdir -p public/es
sed \
-e "s|\[EMAIL_ADDRESS\]|${CONTACT_EMAIL}|g" \
-e "s|\[UMAMI_WEBSITE_ID\]|${UMAMI_WEBSITE_ID}|g" \
es/index.html > public/es/index.html
# Copy static assets unchanged
cp -v og-image-*.jpg umami.js robots.txt sitemap.xml public/ 2>/dev/null || true
echo "✅ Build complete. Output in ./public/"
echo " HTML pages: $(find public -name '*.html' | wc -l)"
echo " Total size: $(du -sh public | cut -f1)"