Skip to content

Backup

Backup #560

Workflow file for this run

name: Backup
on:
schedule:
- cron: '0 0 * * *' # UTC == 2 AM EET
workflow_dispatch:
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Backup repositories from GitHub
run: ${GITHUB_WORKSPACE}/backup.sh
env:
# PAT needs these scopes: read:org, repo
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_OWNER: ${{ github.repository_owner }}
#GH_LIST_LIMIT: 3
#- name: Debug - List backups
# run: ls -lah ${GITHUB_WORKSPACE}/backups/
- uses: actions/cache@v4
with:
path: backups
key: backups-${{ github.run_id }}
restore-keys: backups-
sync:
runs-on: ubuntu-latest
needs: [ backup ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: backups
key: backups-${{ github.run_id }}
#- name: Debug - List backups
# run: ls -lah ${GITHUB_WORKSPACE}/backups/
- name: Sync backups to S3
run: ${GITHUB_WORKSPACE}/s3.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
ENDPOINT_URL: ${{ secrets.ENDPOINT_URL }}
cleanup:
runs-on: ubuntu-latest
needs: [ sync ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Delete workflow runs and cache
run: ${GITHUB_WORKSPACE}/cleanup.sh
env:
GH_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}