Run sync on a schedule #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Run sync on a schedule' | |
on: | |
schedule: | |
- cron: '15 10 * * 6' | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
sync-task: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install python dependencies | |
run: make install ARGS="--only main" | |
- name: Install rclone | |
run: | | |
sudo apt update -y | |
sudo apt install -y rclone | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
aws-region: us-east-1 | |
- name: Retrieve Google Drive API credentials and generate rclone config | |
env: | |
SECRET_NAME: ${{ secrets.SECRET_NAME }} | |
run: | | |
make run ARGS="setup" | |
- name: Run rclone sync | |
run: | | |
rclone sync --config .rclone.conf GDrive: AWSS3:${{ secrets.S3_BUCKET_NAME }}/Documents | |
- name: Save refreshed Google Drive API credentials | |
if: always() | |
env: | |
SECRET_NAME: ${{ secrets.SECRET_NAME }} | |
run: | | |
make run ARGS="clean" |