Skip to content

v1.0.0 - Initial Release

Latest
Compare
Choose a tag to compare
@derek-palmer derek-palmer released this 17 May 13:40

Version 1.0.0 - Initial Release

Date: May 17, 2024

Overview

This release introduces the initial version of the GitHub Action for backing up GitHub repositories to an Amazon S3 bucket. The action supports both user and organization repositories, including handling private repositories and repositories using Git LFS (Large File Storage).

Features

Backup GitHub Repositories to S3

  • The action clones all repositories owned by the authenticated user or specified organization and compresses them into a zip file.
  • The compressed backup file is uploaded to a specified Amazon S3 bucket.

Supports Private Repositories

  • Uses a GitHub Personal Access Token (PAT) with the repo scope to access private repositories.

Git LFS Support

  • Installs and configures Git LFS to handle repositories that use Git LFS for storing large files.

Scheduled and Manual Backups

  • Supports scheduling backups using cron syntax.
  • Allows manual triggering of the backup workflow.

Usage

GitHub Secrets

  • GH_TOKEN: GitHub Personal Access Token with repo scope.
  • AWS_ACCESS_KEY_ID: AWS Access Key ID.
  • AWS_SECRET_ACCESS_KEY: AWS Secret Access Key.
  • AWS_DEFAULT_REGION: AWS region.
  • S3_BUCKET: Name of the S3 bucket.
  • GH_ORG_NAME (optional): GitHub organization name (if backing up an organization's repositories).

Example Workflow

Create a workflow file in your repository (e.g., .github/workflows/backup.yml) with the following content:

name: Backup GitHub Repos to S3

on:
  schedule:
    - cron: '0 2 * * *' # Runs every day at 2 AM UTC
  workflow_dispatch: # Allows manual triggering of the workflow

jobs:
  backup:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Run backup action
        uses: derek-palmer/[email protected]
        with:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
          S3_BUCKET: ${{ secrets.S3_BUCKET }}
          GH_ORG_NAME: ${{ secrets.GH_ORG_NAME }} # Only required if backing up an organization's repositories

Contact and Support

For issues, questions, or feature requests, please open an issue in the GitHub repository.