Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/scripts/deploy-website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ connect_for() {
settings="set ftp:ssl-force true; set ftp:ssl-protect-data true; set ssl:verify-certificate ${DEPLOY_VERIFY_CERT:-yes}" ;;
*) echo "DEPLOY_PROTOCOL muss auto, sftp oder ftps sein" >&2; exit 1 ;;
esac
printf '%s' "$settings; set net:max-retries 3; set net:timeout 30; set cmd:fail-exit yes
# use-temp-file: erst unter einem Hilfsnamen hochladen, dann umbenennen. So sieht niemand halb hochgeladene Seiten.
printf '%s' "$settings; set net:max-retries 3; set net:timeout 30; set cmd:fail-exit yes; set xfer:use-temp-file yes
open --env-password -u \"$DEPLOY_USER\" $url"
}

Expand Down Expand Up @@ -125,6 +126,17 @@ done < "$work/stale"
echo "Dateien: $(wc -l < "$work/new") hochladen, $(wc -l < "$work/rm.lftp") veraltete löschen (Ziel: $REMOTE_DIR)"
sed 's/^rm -f / löschen: /' "$work/rm.lftp"

# .htaccess: Ein vorhandenes (z. B. mit HTTPS-Weiterleitung) bleibt erhalten,
# nur unser Block zwischen den BEGIN/END-Zeilen wird ersetzt bzw. angehängt.
cache_conf="$(dirname "$0")/htaccess-cache.conf"
if ! lftp -c "$connect; get .htaccess -o \"$work/htaccess.old\"" 2>/dev/null; then
: > "$work/htaccess.old"
fi
sed '/^# BEGIN VisuStruct-Cache/,/^# END VisuStruct-Cache/d' "$work/htaccess.old" > "$work/htaccess"
[ -s "$work/htaccess" ] && [ -n "$(tail -c 1 "$work/htaccess")" ] && echo >> "$work/htaccess"
echo ".htaccess: $(grep -vc '^#\|^$' "$work/htaccess" || true) vorhandene Zeilen bleiben erhalten, der Cache-Block wird gesetzt."
cat "$cache_conf" >> "$work/htaccess"

if [ "$DRY_RUN" = "1" ]; then
lftp -c "$connect; mirror -R --dry-run --no-perms --exclude-glob .DS_Store \"$SOURCE_DIR\" ." 2> >(tee "$work/err" >&2) || fail
echo "Trockenlauf: nichts geändert."
Expand All @@ -138,6 +150,7 @@ $connect
mirror -R --no-perms --parallel=4 --exclude-glob .DS_Store --exclude-glob *.html "$SOURCE_DIR" .
mirror -R --no-perms --parallel=4 --exclude-glob .DS_Store "$SOURCE_DIR" .
source "$work/rm.lftp"
put "$work/htaccess" -o .htaccess
put "$work/new" -o $MANIFEST
LFTP
echo "Fertig."
12 changes: 12 additions & 0 deletions .github/scripts/htaccess-cache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# BEGIN VisuStruct-Cache (wird beim Deploy gesetzt, nicht von Hand ändern)
# Seiten immer beim Server nachfragen, damit nach einem Update kein altes index.html bleibt.
# Skripte und Stylesheets der App tragen einen Hash im Namen und dürfen lange im Cache bleiben.
<IfModule mod_headers.c>
<FilesMatch "\.html?$">
Header set Cache-Control "no-cache"
</FilesMatch>
<If "%{REQUEST_URI} =~ m#/app/assets/#">
Header set Cache-Control "public, max-age=31536000, immutable"
</If>
</IfModule>
# END VisuStruct-Cache
Loading