fix(backup): exclude runtime artifacts and keep code backup clean
This commit is contained in:
@@ -4,3 +4,4 @@ state/tmp/
|
||||
|
||||
__pycache__/
|
||||
*.pyc
|
||||
backups/
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
c12e3311b83081a11088001b31f7a698de8f349460000c9914d189d00a2ab207 /srv/prime-core/backups/state/state-20260311T204828Z.tar.gz
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
c12e3311b83081a11088001b31f7a698de8f349460000c9914d189d00a2ab207 /srv/prime-core/backups/state/state-20260311T205918Z.tar.gz
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
c12e3311b83081a11088001b31f7a698de8f349460000c9914d189d00a2ab207 /srv/prime-core/backups/state/state-20260311T210329Z.tar.gz
|
||||
Binary file not shown.
@@ -4,8 +4,7 @@ BASE=/srv/prime-core
|
||||
cd "$BASE"
|
||||
source "$BASE/.secrets/git.env"
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
export GIT_SSH_COMMAND="ssh -i $GIT_SSH_KEY -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
|
||||
EXPECTED='git@git.aeternalisgames.com:ashard_bot/prime-core.git'
|
||||
EXPECTED='https://git.aeternalisgames.com/ashard_bot/prime-core.git'
|
||||
|
||||
origin_url=$(git remote get-url origin 2>/dev/null || true)
|
||||
if [[ "$origin_url" != "$EXPECTED" ]]; then
|
||||
@@ -13,10 +12,12 @@ if [[ "$origin_url" != "$EXPECTED" ]]; then
|
||||
git remote add origin "$EXPECTED"
|
||||
fi
|
||||
|
||||
# never include runtime artifacts in code backup
|
||||
git add -A
|
||||
git reset -q backups/ state/ .secrets/ || true
|
||||
if git diff --cached --quiet; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git commit -m "prime-backup(code): $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||
git push origin main
|
||||
git push "$GIT_REMOTE" main
|
||||
|
||||
Reference in New Issue
Block a user