Helpful tutorial on how to start:
Getting started: https://www.youtube.com/watch?v=I5ili_1G0Vk
How to intagrate drive API: https://www.youtube.com/watch?v=9K2P2bWEd90&list=PL3JVwFmb_BnTamTxXbmlwpspYdpmaHdbz
Google API reference: https://developers.google.com/workspace/drive/api/reference/rest
Google Cloude Console: https://console.cloud.google.com/welcome
- go to https://console.cloud.google.com/welcome
- Create project: near GoogleCloud logo -> Create Project -> New Project
- enable OAuth Consent Screen: navigation menu -> APIs & Services -> OAuth consent screen - set external + provide app name and email + add scope (/auth/drive)
- enable drive integration: navigation menu -> APIs & Services -> Library -> Google Drive API -> Enable
- generate credentials: navigation menu -> APIs & Services -> Credentials -> DesktopApp -> Download JSON credentials file
- generate authentication token: Run the
./update_drive.pyscript for the first time. It will ask you to open link to authorize with Google account. This will generate*.picklefile - encode the token file in base-64:
base64 -w 0 token_drive_v3.pickle > token_b64.txtcommand - encode the credentials file in base-64:
base64 -w 0 credentials.json > credentials_b64.txt - set secrects in GitHub repo: GitHub -> Settings -> Security | Serets and variables -> Actions -> New Repository Secret -> GDRIVE_TOKEN_B64 and GDRIVE_CREDENTIALS_B64
- get google drive folder id: Google Drive -> Share -> Copy Link. Copy part after
/folders/ - set google drive folder id: in update_drive.py change
YOUR_FOLDER_IDto your destination google drive folder ID extracted in the previous step - voila!: any file you put in shared folder and commit will be automatically uploaded to Google Drive
- Empty folders on github are not commited. In order to commit empty folder, you need to create ".gitkeep" file. It will be removed automatically befor upload to Google Drive.
- For shared repo usage instruction read HowToUse.md