Skip to content

Commit

Permalink
Update backup.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mgz0227 authored May 3, 2024
1 parent fbbb19c commit 0b6a3c9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
name: Upload Backup
name: Backup Main Branch

on:
push:
branches:
- main

jobs:
upload_backup:
backup:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
ref: main

- name: Create backup directory
run: mkdir -p backup

- name: Archive main branch as tar.gz
run: |
tar -czf main_backup_$(date +"%Y%m%d").tar.gz *
tar -czf backup/main_backup_$(date +"%Y%m%d").tar.gz *
working-directory: ${{ github.workspace }}

- name: Set up Git
Expand All @@ -26,6 +31,6 @@ jobs:
run: |
git branch -D backup || true
git checkout -b backup
git add main_backup_$(date +"%Y%m%d").tar.gz
git add backup/main_backup_$(date +"%Y%m%d").tar.gz
git commit -m "Backup main branch as of $(date +"%Y-%m-%d")"
git push origin backup

0 comments on commit 0b6a3c9

Please sign in to comment.