🎄 GitHub Actions Advent Calendar

moon indicating dark mode
sun indicating light mode

Day 12: Sync with S3

December 12, 2019

jakejarvis/s3-sync-action is a wrapper for the AWS S3 client so you can send files into your S3 Buckets.

Example Usage

An Example workflow could be uploading a directory into a S3 bucket for things like publishing a static website. With AWS, you’ll need the default AWS credentials, the bucket, and the directory you want to sync. With an args parameter, you can pass in any of the flags from the aws s3 cli command.

name: Upload Website
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
SOURCE_DIR: 'public' # optional: defaults to entire repository