From 6bdbb6bfe8bfad0493a43816cb801501981994cc Mon Sep 17 00:00:00 2001 From: miaogongzi <69211489+mgz0227@users.noreply.github.com> Date: Fri, 3 May 2024 21:00:21 +0800 Subject: [PATCH] Update backup.yml --- .github/workflows/backup.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 769fc5d3..a788a26e 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -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 @@ -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 @@ -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"