GithubHelp home page GithubHelp logo

vitorsgomes / s3-rm-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jakejarvis/s3-sync-action

7.0 0.0 9.0 45 KB

🔄 GitHub Action to sync a directory with a remote S3 bucket 🧺

Home Page: https://github.com/marketplace/actions/s3-sync

License: MIT License

Dockerfile 31.30% Shell 68.70%

s3-rm-action's Introduction

GitHub Action to delete files from S3 Bucket

Fork of s3-sync-action.

This simple action uses the vanilla AWS CLI to delete files from a S3 bucket.

Usage

workflow.yml Example

Place in a .yml file such as this one in your .github/workflows folder. Refer to the documentation on workflow YAML syntax here.

All aws s3 rm flags are optional to allow for maximum customizability (that's a word, I promise) and must be provided by you via args:.

The following example includes a parameter to delete all files inside a folder:

  • --recursive will delete recursively, removing folders and files inside those folders.
name: Delete branch folder

on:
  delete:
    branches:
      - '*'
      - '!master'
jobs:
  remove:
    runs-on: ubuntu-latest
    
    steps:
    - name: Remove from S3
      uses: vitorsgomes/s3-rm-action@master
      with:
        args: --recursive
      env:
        AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }}
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        AWS_REGION: ${{ secrets.AWS_REGION }}
        PATH_TO_DELETE: ${{ github.event.ref }}

Configuration

The following settings must be passed as environment variables as shown in the example. Sensitive information, especially AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, should be set as encrypted secrets — otherwise, they'll be public to anyone browsing your repository's source code and CI logs.

Key Value Suggested Type Required Default
AWS_ACCESS_KEY_ID Your AWS Access Key. More info here. secret env Yes N/A
AWS_SECRET_ACCESS_KEY Your AWS Secret Access Key. More info here. secret env Yes N/A
AWS_S3_BUCKET The name of the bucket you're removing something. For example, jarv.is or my-app-releases. secret env Yes N/A
AWS_REGION The region where you created your bucket. Set to us-east-1 by default. Full list of regions here. env No us-east-1
AWS_S3_ENDPOINT The endpoint URL of the bucket you're syncing to. Can be used for VPC scenarios or for non-AWS services using the S3 API, like DigitalOcean Spaces. env No Automatic (s3.amazonaws.com or AWS's region-specific equivalent)
PATH_TO_DELETE The path to the file or directory inside of the S3 bucket you wish to remove. For example, my_project/assets. Defaults to the root of the bucket. env No / (root of bucket)

License

This project is distributed under the MIT license.

s3-rm-action's People

Contributors

danielsinclair avatar jakejarvis avatar rmcfadzean avatar timoschilling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  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.