-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |