A simple GitHub action to upload files to Google Drive (including support for large files).
- Works with large files.
- Can upload multiple files using a wildcard (
my/path/*.txt
). - Lightweight, with a cold start time of less than 15 seconds.
- Works on Windows, Linux, and Mac.
- Backed by a well-known and widely used upload library (RClone).
Required: YES.
The ID of the folder you want to upload to.
To find the Folder ID
, look at the URL of your Google Drive folder. For example:
https://drive.google.com/drive/folders/xxxx
Here, the Folder ID
is the part after /folders/
, which in this case is xxxx
.
Required: YES.
A base64-encoded string of the Google Cloud Service Account Key.
- Access the
Google Cloud
Credentials
page: https://console.cloud.google.com/apis/credentials - Create a new
Service Account
. - Generate a new
JSON
key. - Convert the key to base64 using:
cat service_account_key.json | base64 > service_account_key_base64.txt
- Add the base64 string as a secret in your GitHub account (or organization).
Required: YES.
The local path to the file(s) to upload.
Required: NO.
The destination path in Google Drive.
Required: NO.
The cutoff size for switching to chunked uploads. This allows large files to be uploaded without encountering HTTP 429 errors.
- name: Upload to Google Drive
uses: samuelint/google-drive-upload@v1.0.1
with:
folder_id: <your folder id>
service_account: ${{ secrets.GOOGLE_DRIVE_SERVICE_ACCOUNT }}
source_path: your_file.txt
- name: Upload to Google Drive
uses: samuelint/google-drive-upload@v1.0.1
with:
folder_id: <your folder id>
service_account: ${{ secrets.GOOGLE_DRIVE_SERVICE_ACCOUNT }}
source_path: your_large_file.zip
upload_cutoff: 10G # <Optional> Set to avoid HTTP 429 on large file upload
Use 2 steps with artofact upload strategy.
- Produce the binary (in the OS you want)
- Upload
name: Release
on:
release:
types: [published]
jobs:
build_my_app:
name: Build my app For Release
environment: release
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: <some build command>
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ui-dist
path: dist/*.zip
retention-days: 1
upload_to_gdrive_windows:
name: Upload to Google Drive
needs: build_my_app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: ui-dist
path: dist
- name: Upload to Google Drive
uses: samuelint/google-drive-upload@v1.0.1
with:
folder_id: <your folder id>
service_account: ${{ secrets.GOOGLE_DRIVE_SERVICE_ACCOUNT }}
source_path: dist/*.zip
upload_cutoff: 10G # <Optional> Set to avoid HTTP 429 on large file upload