Skip to content

Github action to upload files to Google Drive using a service account

Notifications You must be signed in to change notification settings

wodndb/google-drive-upload-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

Google Drive File Uploader

Github action to upload files to Google Drive using a service account.

(Forked from https://github.com/willo32/google-drive-upload-action)

Usage

Simple example:

steps:
    - uses: actions/checkout@v3

    - name: Upload files to Google Drive
      uses: wodndb/google-drive-upload-action@v1
      with:
        target: |-
          <LOCAL_PATH_TO_YOUR_FILES_1>
          <LOCAL_PATH_TO_YOUR_FILES_2>
          ...
        credentials: ${{ secrets.<YOUR_SERVICE_ACCOUNT_CREDENTIALS> }}
        parent_folder_id: <YOUR_DRIVE_FOLDER_ID>

Inputs

target (Required):

Local path to the files to upload, can be relative from github runner current directory.

credentials (Required):

A service account public/private key pair encoded in base64.

Generate and download your credentials in JSON format

Run base64 my_service_account_key.json > encoded.txt and paste the encoded string into a github secret.

parent_folder_id (Required):

The id of the drive folder where you want to upload your files. It is the string of characters after the last / when browsing to your folder URL. You must share the folder with the service account (using its email address) unless you specify a owner.

child_folder (Optional):

A sub-folder where to upload your files. It will be created if non-existent and must remain unique. Useful to organize your drive like so:

📂 Release // parent folder
 ┃
 ┣ 📂 v1.0 // child folder
 ┃ ┗ 📜 uploaded_file_v1.0
 ┃
 ┣ 📂 v2.0 // child folder
 ┃ ┗ 📜 uploaded_file_v2.0

owner (Optional):

The email address of a user account that has access to the drive folder and will get the ownership of the file after its creation. To use this feature you must grant your service account a domain-wide delegation of authority beforehand.

For developer

  • You should run yarn build and push build file before release.

About

Github action to upload files to Google Drive using a service account

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%