Skip to content

Update backup.yml

Update backup.yml #7

Workflow file for this run

name: Backup Main Branch
on:
push:
branches: [ main ]
jobs:
backup:
name: Backup Main Branch
runs-on: ubuntu-latest
env:
BACKUP_DATETIME: ${{ steps.datetime.outputs.datetime }}

Check failure on line 12 in .github/workflows/backup.yml

View workflow run for this annotation

GitHub Actions / Backup Main Branch

Invalid workflow file

The workflow is not valid. .github/workflows/backup.yml (Line: 12, Col: 24): Unrecognized named-value: 'steps'. Located at position 1 within expression: steps.datetime.outputs.datetime
steps:
- name: Checkout Main Branch
uses: actions/checkout@v2
with:
ref: main
- 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: |
git archive --format=tar.gz --output=main_backup_${BACKUP_DATETIME}.tar.gz HEAD
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Add Backup Branch
run: |
git checkout -b backup || git checkout backup
mkdir -p backups
mv main_backup_${BACKUP_DATETIME}.tar.gz backups/
git add -A
git commit -m "Auto backup main branch code"
git push origin backup
- name: Switch Back to Main Branch
run: git checkout main