Update backup.yml #15
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
name: Backup Main Branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
backup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Archive main branch as tar.gz | |
run: | | |
tar -czf main_backup_$(date +"%Y%m%d").tar.gz * | |
working-directory: ${{ github.workspace }} | |
- name: Configure Git | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "mgz0227" | |
- name: Create and push backup branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.HARMONY_BACKUP }} | |
run: | | |
git checkout -b backup | |
git add main_backup_$(date +"%Y%m%d").tar.gz | |
git commit -m "Backup main branch as of $(date +"%Y-%m-%d")" | |
git push origin backup |