Skip to content

Sync a Github repository with a Google Cloud Storage bucket.

License

Notifications You must be signed in to change notification settings

pablo-statsig/gcs-bucket-sync-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCS Bucket Sync Action

This action helps by easily syncing a Github repository with a Google Cloud Storage bucket. It is very generic and can be used for different purposes. I used it for uploading my static website.

Features

  • Sync files/directories from your repository to your bucket
  • Delete files/directories from your bucket which where removed in your repository
  • Exclude certain files from being synced with the bucket

Requirements

  • An existing empty* bucket
  • A service account with access to the bucket
  • The service account key (json format)

*If you want to sync to an exiting bucket, make sure that your repository includes the whole content of it, otherwise you could lose data!

Inputs

  • secrets Your Google service account credentials as json. (Required)
  • bucket Name of the target bucket. (Required)
  • sync_dir Directory path to sync, relative to bucket, for example, my_folder/to_sync. It is empty by default.
  • exclude Regex for excluding files/dirs. (gsutil rsync doc)

Example

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Sync
        uses: patrickwyler/gcs-bucket-sync-action@1.3
        with:
          secrets: ${{ secrets.google_service_account_credentials }}
          bucket: 'patrickwyler.com'
          exclude: '.*\.md$|\.gitignore$|\.git/.*$|\.github/.*$'

Diagram

Diagram

Tags

GCP, Google Cloud Platform, GCS, Google Cloud Storage, Bucket, Sync, Syncing, Uploading, Upload

About

Sync a Github repository with a Google Cloud Storage bucket.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 80.5%
  • Dockerfile 19.5%