Add backup workflow

This commit is contained in:
2026-06-23 11:33:54 +02:00
parent 21fe0f1250
commit a270df72e8
3 changed files with 50 additions and 1 deletions
+25
View File
@@ -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"