Skip to content

Commit

Permalink
自动备份源码
Browse files Browse the repository at this point in the history
  • Loading branch information
mgz0227 authored May 3, 2024
1 parent 40698ae commit 3b3b640
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Backup Main Branch

on:
push:
branches:
- main

jobs:
backup:
name: Backup Main Branch
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

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

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

- name: Archive Main Branch Code
run: tar -zcf main_backup.tar.gz -C backups/main .

- name: Commit and Push Backup
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Auto backup main branch code"
branch: backup
author_name: GitHub Actions
author_email: [email protected]

- name: Push Backup Archive
uses: actions/upload-artifact@v2
with:
name: main_backup
path: main_backup.tar.gz

0 comments on commit 3b3b640

Please sign in to comment.