Giter VIP home page Giter VIP logo

do-spaces's Introduction

DigitalOcean Spaces Action

GitHub Action to sync DigitalOcean Spaces, purge changes from DigitalOcean CDN and Cloudflare cache.

โš ๏ธ Set DELETE_UNTRACKED: false if you wish to keep files in space that are not present in LOCAL_DIR.

Usage

Setup this workflow action like .github/workflows/<name_this>.yml

  • Sync all repository
name: DigitalOcean Spaces Action
on: push
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
      - name: Sync DigitalOcean Spac
        uses: laukstein/do-spaces@main
        env:
          DO_ACCESS: ${{ secrets.DO_ACCESS }}
          DO_SECRET: ${{ secrets.DO_SECRET }}
          DO_NAME: ${{ secrets.DO_NAME }}
          DO_REGION: ams3
  • Sync directory /public and purge changes from DigitalOcean CDN
name: DigitalOcean Spaces Action
on:
  push:
    paths: public/**
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@main
        with:
          fetch-depth: 0
      - name: Sync DigitalOcean Spac, purge changes from the CDN
        uses: laukstein/do-spaces@main
        env:
          DO_TOKEN: ${{ secrets.DO_TOKEN }}
          DO_ACCESS: ${{ secrets.DO_ACCESS }}
          DO_SECRET: ${{ secrets.DO_SECRET }}
          DO_NAME: ${{ secrets.DO_NAME }}
          DO_REGION: ams3
          LOCAL_DIR: public
name: DigitalOcean Spaces Action
on:
  push:
    paths: public/**
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@main
        with:
          fetch-depth: 0
      - name: Sync DigitalOcean Space, purge changes from the CDN and Cloudflare cache
        uses: laukstein/do-spaces@main
        env:
          DO_TOKEN: ${{ secrets.DO_TOKEN }}
          DO_ACCESS: ${{ secrets.DO_ACCESS }}
          DO_SECRET: ${{ secrets.DO_SECRET }}
          DO_NAME: ${{ secrets.DO_NAME }}
          DO_REGION: ams3
          SPACE_DIR: img
          CF_TOKEN: ${{ secrets.CF_TOKEN }}
          CF_ZONE: ${{ secrets.CF_ZONE }}
          CF_URL: https://cdn.mydomain.com/img/
          LOCAL_DIR: public

DigitalOcean Space variables

Key Value Suggested Type Required Default
DO_ACCESS Your Spaces Access Key. See details. secret env Yes N/A
DO_SECRET Your Spaces Secret Access Key. See details. secret env Yes N/A
DO_NAME The name of the space you're syncing to. For example, my-space. secret env Yes N/A
DO_REGION The region where you created your space in. For example, ams3. See supported regions. env Yes N/A
SPACE_DIR The directory inside of the space you wish to sync to. For example, my_project. Defaults to the root of the space. env No /
LOCAL_DIR The local directory you wish to sync. For example, public. Defaults to your entire repository. env No /
DELETE_UNTRACKED If empty or set to true, deletes any files in the space that are not present in the source directory. env No true
FILES_PRIVATE Make files private, default false. env No false
EXCLUDE_LIST Use .s3ignore when set to true allowing you to exclude paths and files env No false
ADD_HEADER Add custom header e.g. Content-Encoding:gzip. See supported headers. env No N/A
DO_TOKEN Personal access token with Write scope, required only to purge DigitalOcean CDN. See details. secret env No N/A

Cloudflare purge cache variables

Key Value Suggested Type Required Default
CF_TOKEN Cloudflare token with zone access to Purge cache. See details. secret env No N/A
CF_ZONE Cloudflare Zone ID, can find in Cloudflare Overview tab for the domain. secret env No N/A
CF_URL e.g. https://cdn.mydomain.com/img/ or https://cdn.mydomain.com where the CDN is used on enabled Cloudflare proxy. env No N/A

License

This project is distributed under the MIT license.

do-spaces's People

Contributors

laukstein avatar mar0xy avatar

Stargazers

 avatar

Watchers

 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.