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 ee9ba5d commit d6b5833
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Backup Master Branch
name: Backup Main Branch

on:
push:
branches: [ master ]
branches: [ main ]

jobs:
backup:
name: Backup Master Branch
name: Backup Main Branch
runs-on: ubuntu-latest
steps:
- name: Checkout Master Branch
- name: Checkout Main Branch
uses: actions/checkout@v2
with:
ref: master
ref: main

- name: Create Backup Directory
run: mkdir -p backups/master
run: mkdir -p backups/main

- name: Copy Master Branch Code
run: cp -r * backups/master
- name: Copy Main Branch Code
run: cp -r * backups/main

- name: Archive Master Branch Code
- name: Archive Main Branch Code
run: |
datetime=$(date '+%Y-%m-%d_%H-%M-%S')
tar -zcf master_backup_$datetime.tar.gz -C backups/master .
tar -zcf main_backup_$datetime.tar.gz -C backups/main .
- name: Configure Git
run: |
Expand All @@ -35,8 +35,8 @@ jobs:
git checkout -b backup || git checkout backup
git rm -rf .
git add -A
git commit -m "Auto backup master branch code"
git commit -m "Auto backup main branch code"
git push origin backup
- name: Switch Back to Master Branch
run: git checkout master
- name: Switch Back to Main Branch
run: git checkout main

0 comments on commit d6b5833

Please sign in to comment.