From 358dc8b0af62afd0b401619f48dd6db8e929a855 Mon Sep 17 00:00:00 2001 From: SGX21 Date: Thu, 23 Jan 2025 21:46:53 +0530 Subject: [PATCH] Branch names fixing --- .github/workflows/s.yml | 43 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/s.yml b/.github/workflows/s.yml index c720af8c..426f8b30 100644 --- a/.github/workflows/s.yml +++ b/.github/workflows/s.yml @@ -2,44 +2,41 @@ name: Sync Google Drive to S3 on: push: - branches: drive-to-s3 - - workflow_dispatch: #can be triggered manually + branches: feat/drive-to-s3 + + workflow_dispatch: schedule: - - cron: "0 0 * * *" # every day at 00:00 utc + - cron: "0 0 * * *" # every day at 00:00 UTC jobs: sync: runs-on: ubuntu-latest steps: - - name: Install AWS CLI and GDrive + - name: Install AWS CLI and rclone run: | sudo apt-get update sudo apt-get install -y unzip - curl -Ls https://github.com/prasmussen/gdrive/releases/download/2.1.0/gdrive-linux-x64 > gdrive - chmod +x gdrive - sudo mv gdrive /usr/local/bin/ - aws --version - gdrive version + curl -Ls https://downloads.rclone.org/rclone-current-linux-amd64.zip -o rclone.zip + unzip rclone.zip + cd rclone-*-linux-amd64 + sudo cp rclone /usr/local/bin/ + rclone --version - - name: Authenticate GDrive + - name: Configure rclone for Google Drive env: - GDRIVE_TOKEN: ${{ secrets.GDRIVE_TOKEN }} + RCLONE_CONFIG: ${{ secrets.RCLONE_CONFIG }} run: | - echo "${GDRIVE_TOKEN}" > ~/.gdrive_token - gdrive about + mkdir -p ~/.config/rclone + echo "${RCLONE_CONFIG}" > ~/.config/rclone/rclone.conf + rclone config show - - name: Download Folder from Google Drive + - name: Sync Folder from Google Drive + env: + RCLONE_CONFIG: ${{ secrets.RCLONE_CONFIG }} run: | mkdir -p downloads - gdrive download --recursive --path downloads/ - - - name: Unzip Downloaded Folder - run: | - for zip_file in downloads/*.zip; do - unzip -o "$zip_file" -d downloads/unzipped/ - done + rclone copy gdrive:isaac-s3-images downloads/ --drive-root-folder-id 1YLdE1YjT1qSU8ank-ZVhYs5cl0jQohS8 --verbose - name: Rename Existing Folder in S3 to Backup env: @@ -55,7 +52,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: ap-south-1 run: | - aws s3 cp downloads/unzipped/ s3://your-bucket-name/isaac-s3-images/ --recursive --acl public-read + aws s3 cp downloads/ s3://your-bucket-name/isaac-s3-images/ --recursive --acl public-read - name: Delete Backup Folder from S3 if: success()