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 c7499cb commit 6bdbb6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
backup:
name: Backup Main Branch
runs-on: ubuntu-latest
env:
BACKUP_DATETIME: ${{ steps.datetime.outputs.datetime }}
steps:
- name: Checkout Main Branch
uses: actions/checkout@v2
Expand All @@ -19,9 +17,10 @@ jobs:
- name: Get Current Datetime
id: datetime
run: echo "::set-output name=datetime::$(date '+%Y-%m-%d_%H-%M-%S')"

- name: Archive Main Branch Code
run: |
BACKUP_DATETIME=$(echo "${{ steps.datetime.outputs.datetime }}")
git archive --format=tar.gz --output=main_backup_${BACKUP_DATETIME}.tar.gz HEAD
- name: Configure Git
Expand All @@ -33,6 +32,7 @@ jobs:
run: |
git checkout -b backup || git checkout backup
mkdir -p backups
BACKUP_DATETIME=$(echo "${{ steps.datetime.outputs.datetime }}")
mv main_backup_${BACKUP_DATETIME}.tar.gz backups/
git add -A
git commit -m "Auto backup main branch code"
Expand Down

0 comments on commit 6bdbb6b

Please sign in to comment.