Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Repository Backup

Repository Backup #5

Workflow file for this run

name: Repository Backup
on:
schedule:
# Weekly backup (every Sunday at 03:00 UTC)
- cron: '0 3 * * 0'
# Monthly backup release (1st day of every month at 03:00 UTC)
- cron: '0 3 1 * *'
workflow_dispatch:
inputs:
reason:
description: Reason for manual backup
required: false
default: Manual backup requested
jobs:
backup:
name: Create Repository Backup
runs-on: ubuntu-latest
steps:
- name: Checkout repository (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create backup archive
run: |
BACKUP_DATE=$(date +'%Y-%m-%d_%H-%M-%S')
BACKUP_NAME="macroEngine-dp-backup-${BACKUP_DATE}"
echo "Creating backup: ${BACKUP_NAME}"
cat > backup-manifest.txt << EOF
Backup Information
==================
Date: $(date -u)
Repository: macroEngine-dp
Commit: $(git rev-parse HEAD)
Branch: $(git rev-parse --abbrev-ref HEAD)
EOF
tar --warning=no-file-changed -czf "${BACKUP_NAME}.tar.gz" \
--exclude='.git' \
--exclude='node_modules' \
--exclude='*.log' \
--exclude="${BACKUP_NAME}.tar.gz" \
. || [[ $? -eq 1 ]]
git bundle create "${BACKUP_NAME}.bundle" --all
ls -lh ${BACKUP_NAME}*
- name: Upload backup artifacts
uses: actions/upload-artifact@v4
with:
name: repository-backup-${{ github.run_number }}
path: |
*.tar.gz
*.bundle
backup-manifest.txt
retention-days: 90
- name: Create backup release (monthly)
if: github.event_name == 'schedule' && github.event.schedule == '0 3 1 * *'
uses: softprops/action-gh-release@v1
with:
tag_name: backup-${{ github.run_number }}
name: Monthly Backup - ${{ github.run_number }}
files: |
*.tar.gz
*.bundle
backup-manifest.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}