Add backup workflow
This commit is contained in:
@@ -3,3 +3,4 @@ Thumbs.db
|
|||||||
*~
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
|
backups/
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Ruhepunkt
|
||||||
|
|
||||||
|
Statische Website ohne Build-Prozess. Alle auslieferbaren Dateien liegen direkt im Repository.
|
||||||
|
|
||||||
|
## Backup-Workflow
|
||||||
|
|
||||||
|
Ein versioniertes Backup der aktuellen Git-Version kann so erstellt werden:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/create-backup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Optional kann ein eigenes Zielverzeichnis uebergeben werden:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/create-backup.sh /pfad/zum/backup-ordner
|
||||||
|
```
|
||||||
|
|
||||||
|
Das Skript erzeugt ein komprimiertes Archiv aus dem aktuellen `HEAD` und legt es standardmaessig unter `backups/` ab.
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
Da es sich um eine statische Seite handelt, ist ein Deployment per Upload oder `rsync` grundsaetzlich einfach moeglich. Fuer eine automatische Deployment-Konfiguration fehlen im Repository aktuell aber noch die Zielinformationen, etwa Server, Pfad und Zugangsmethode.
|
||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
output_dir="${1:-$repo_root/backups}"
|
||||||
|
|
||||||
|
if ! git -C "$repo_root" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
echo "Kein Git-Repository gefunden: $repo_root" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$output_dir"
|
||||||
|
|
||||||
|
timestamp="$(date +%Y%m%d-%H%M%S)"
|
||||||
|
short_sha="$(git -C "$repo_root" rev-parse --short HEAD)"
|
||||||
|
archive_name="ruhepunkt-${timestamp}-${short_sha}.tar.gz"
|
||||||
|
archive_path="$output_dir/$archive_name"
|
||||||
|
|
||||||
|
git -C "$repo_root" archive \
|
||||||
|
--format=tar.gz \
|
||||||
|
--output="$archive_path" \
|
||||||
|
HEAD
|
||||||
|
|
||||||
|
echo "Backup erstellt: $archive_path"
|
||||||
Reference in New Issue
Block a user