Skip to content

Commit

Permalink
Branch names fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
SGX21 committed Jan 23, 2025
1 parent 0242407 commit 358dc8b
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions .github/workflows/s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/ <YOUR_GOOGLE_DRIVE_FOLDER_ID>
- 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:
Expand All @@ -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()
Expand Down

0 comments on commit 358dc8b

Please sign in to comment.