A GitHub Actions project that automatically uploads the ApkFile folder to Google Drive — triggered on every push to main or manually via the Actions tab.
The workflow (.github/workflows/upload-apk-to-drive.yml) runs when:
- You push any commit to the
mainbranch - You manually trigger it from the GitHub Actions tab (
workflow_dispatch)
It uses rclone to upload the contents of ApkFile/ to Google Drive.
Not sure which to use?
- Personal Google account (gmail.com) → use Option A
- Google Workspace (company/school account with Shared Drives) → use Option B
Service accounts cannot upload to a personal Google Drive (no storage quota). Instead, rclone uses an OAuth refresh token that uploads as your own Google account using your personal 15 GB quota.
brew install rclonerclone authorize "drive"- A browser window will open — log in with your Google account and click Allow
- rclone prints a JSON token in the terminal that looks like:
{"access_token":"...","token_type":"Bearer","refresh_token":"...","expiry":"..."} - Copy the entire JSON block
Open the target folder in Google Drive. Copy the ID from the URL:
https://drive.google.com/drive/folders/<FOLDER_ID_IS_HERE>
Go to your repo → Settings → Secrets and variables → Actions → New repository secret
| Secret Name | Value |
|---|---|
GDRIVE_OAUTH_TOKEN |
The full JSON token from Step 2 |
The folder ID is hardcoded in the workflow file directly (it is not sensitive).
token = $GDRIVE_OAUTH_TOKEN
scope = drive
root_folder_id = <your-folder-id>Google Workspace accounts support Shared Drives, which have their own storage quota and fully support service accounts. Personal accounts do not support Shared Drives.
- Go to https://console.cloud.google.com
- Create a new project (or use an existing one)
- Enable the Google Drive API:
- Navigate to APIs & Services → Library → Google Drive API → Enable
- Create a Service Account:
- Go to APIs & Services → Credentials → Create Credentials → Service Account
- Give it a name (e.g.,
github-actions-uploader) and click Done
- Open the Service Account → Keys tab → Add Key → Create new key → JSON
- Download the
.jsonkey file
- In Google Drive → left sidebar → Shared drives → + New
- Open the Shared Drive → click its name → Manage members
- Add the service account email (from
"client_email"in the JSON) as Content manager - Copy the Shared Drive ID from its URL:
https://drive.google.com/drive/u/0/folders/<SHARED_DRIVE_ID>
| Secret Name | Value |
|---|---|
GDRIVE_SERVICE_ACCOUNT_KEY |
Full content of the downloaded JSON key file |
GDRIVE_TEAM_DRIVE_ID |
The Shared Drive ID from Step 2 |
service_account_file = /tmp/sa_key.json
team_drive = $GDRIVE_TEAM_DRIVE_ID- Go to your repo on GitHub
- Click the Actions tab
- Select Upload APK Folder to Google Drive
- Click Run workflow → Run workflow
git-action/
├── .github/
│ └── workflows/
│ └── upload-apk-to-drive.yml ← GitHub Actions workflow
├── ApkFile/ ← Put your APK files here
├── index.html
└── README.md