Code Monkey home page Code Monkey logo

gdrive-upload-action's Introduction

build Go Report Card

gdrive-upload-action

Github action that uploads files to Google Drive. This only works with a Google Service Account!

To make a GSA go to the Credentials Dashboard. You will need to download the .json key and base64 encode it. You will use this string as the credentials input. To convert the json file to base64 without having to use an online tool (which is insecure), use this command:

echo -n $(cat credentials.json)| base64 -w 0

You will also need to share the drive with the service account. To do this, just share the folder like you would normally with a friend, except you share it with the service account email address. Additionally you will need to give the service account acccess to the google drive API. Go to https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project={PROJECT_ID}. Where {PROJECT_ID} is the id of your GCP project. Find more info about that here.

Inputs

filename

Required: YES.

The name of the file you want to upload.

name

Required: NO

The name you want the file to have in Google Drive. If this input is not provided, it will use the filename.

folderId

Required: YES.

The ID of the folder you want to upload to.

credentials

Required: YES.

A base64 encoded string with the GSA credentials.

Usage Example

Simple Workflow

In this example we stored the folderId and credentials as action secrets. This is highly recommended as leaking your credentials key will allow anyone to use your service account.

# .github/workflows/main.yml
name: Main
on: [push]

jobs:
  my_job:
    runs-on: ubuntu-latest

    steps:

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Archive files
        run: |
          sudo apt-get update
          sudo apt-get install zip
          zip -r archive.zip *

      - name: Upload to gdrive
        uses: team-tumbleweed/gdrive-upload-action@main
        with:
          filename: "archive.zip"
          name: "documentation.zip"
          folderId: ${{ secrets.folderId }}
          credentials: ${{ secrets.credentials }}

gdrive-upload-action's People

Contributors

adityak74 avatar avolpe avatar duncandewhurst avatar mathisve avatar trizlybear avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.